std::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()}; // 使用显式推导指引
}


版本历史

  • (当前 | 先前 2017年9月26日 (二) 04:18Fruderica讨论 | 贡献 . . (754字节) (+9). . (撤销)
  • 当前 | 先前) 2017年6月16日 (五) 06:27Fruderica讨论 | 贡献. . (745字节) (+745). . (以“{{title|{{tt|std::basic_regex}} 的推导指引}} {{cpp/regex/basic_regex/navbar}} {{dcl begin}} {{dcl header|regex}} {{dcl | since=c++17 |1= template<class ForwardI...”为内容创建页面)