名稱空間
變體
操作

std::basic_regex 的推導指南

來自 cppreference.com
< cpp‎ | regex‎ | basic_regex
 
 
 
正則表示式庫
(C++11)
演算法
迭代器
異常
特性
常量
(C++11)
正則表示式語法
 
 
在標頭檔案 <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
}