名前空間
変種
操作

deduction guides for std::basic_regex

提供: cppreference.com
< cpp‎ | regex‎ | basic regex
ヘッダ <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以上)

イテレータ範囲からの推定を可能とするため、この推定ガイドstd::basic_regex に対して提供されます。

[編集]

#include <regex>
#include <vector>
int main() {
   std::vector<char> v = {'a', 'b', 'c'};
   std::basic_regex re{v.begin(), v.end()}; // uses explicit deduction guide
}