C ++ 0x正则expression式在GCC

以下代码:

#include <regex> using namespace std; (snippage) regex_search(s, m, re); 

在Microsoft C ++中工作,但GCC 4.4.3提供了以下错误消息:

/usr/include/c++/4.4/tr1_impl/regex:2255:warning:inline function'bool std :: regex_search(_Bi_iter,_Bi_iter,std :: match_results <_Bi_iter,_Allocator>&,const std :: basic_regex <_Ch_type,_Rx_traits >&,std :: regex_constants :: match_flag_type)[with _Bi_iter = __gnu_cxx :: _ normal_iterator,std :: allocator>>,_Allocator = std :: allocator,std :: allocator>>>,_Ch_type = char,_Rx_traits = std :: regex_traits]'使用但从未定义

当然,如果正则expression式只是GCC待办事项列表中的C ++ 0x特性之一,那么我也不会感到惊讶,但是我正在摸索的是,为什么它很高兴地采取包含指令,variables声明等等,并且只能通过函数调用(它甚至可以理解)。

有什么我失踪?

正则expression式库大部分都没有在libstdc ++中直到4.8分支。

版本4.9及以上版本确实已经实现了<regex>

  • 针对<regex>实现跟踪器错误
  • C ++ 11的当前库支持状态

对于g ++,用标志“-std = c ++ 0x”