【发布时间】:2023-03-30 14:36:01
【问题描述】:
std::wstring str(L"something");
std::tr1::wregex rx(L"something");
std::tr1::wcmatch res;
std::tr1::regex_search(str, res, rx);
编译失败,报错:
error C2784: 'bool std::tr1::regex_search(const std::basic_string<_Elem,_StTraits,_StAlloc> &,const std::tr1::basic_regex<_Elem,_RxTraits> &,std::tr1::regex_constants::match_flag_type)' : could not deduce template argument for 'const std::tr1::basic_regex<_Elem,_RxTraits> &' from 'std::tr1::wcmatch'
【问题讨论】:
-
请注意,GCC 中对
<regex>的编译器支持仍然非常有限——除非您有最先进的版本,否则您可能可以编译,但不能链接。
标签: c++ regex compiler-errors tr1