在microsoft visual studio中使用char32_t的std :: regex?

时间:2014-08-25 11:42:36

标签: c++ regex visual-studio-2010

嗯,我想知道为什么这不起作用 - 如果这是VS 2010的一个简单问题;

std::basic_regex<char32_t> re;

上面一行给出了编译错误:

1>c:\program files\microsoft visual studio 10.0\vc\include\regex(1975): error C2027: use of undefined type 'std::tr1::regex_traits<_Elem>'
1>          with
1>          [
1>              _Elem=char32_t
1>          ]

还有很多跟进错误,都在同一行。这是一个特定于visual studio 2010的问题 - 是否有解决方法(除了首先将字符串转换为UTF8并将其作为基础然后重新转换回UTF32)。

和/或我应该使用boost::regex然后我会绕过这个问题吗?

1 个答案:

答案 0 :(得分:0)

您很可能需要使用Boost.Regex with ICU

示例:icu_example.cpp

或者,如果你留在Windows上,MFC:mfc_example.cpp