Namespaces
Variants

deduction guides for std::basic_regex

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
ヘッダーで定義 <regex>
template < class ForwardIt >

basic_regex ( ForwardIt, ForwardIt,
std:: regex_constants :: syntax_option_type = std:: regex_constants :: ECMAScript )

- > basic_regex < typename std:: iterator_traits < ForwardIt > :: value_type > ;
(C++17以降)

この deduction guide std::basic_regex に対して提供されており、イテレータ範囲からの推論を可能にします。

#include <regex>
#include <vector>
int main()
{
    std::vector<char> v = {'a', 'b', 'c'};
    std::basic_regex re(v.begin(), v.end()); // 明示的なデダクションガイドを使用
}