GCC中的C++ 0x正则表达式

rwa*_*ace 10 regex gcc c++11

以下代码:

#include <regex>
using namespace std;

(snippage)

regex_search(s, m, re);
Run Code Online (Sandbox Code Playgroud)

适用于Microsoft C++,但GCC 4.4.3提供以下错误消息:

/usr/include/c++/4.4/tr1_impl/regex:2255:警告:内联函数'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)[与_Bi_iter = __gnu_cxx :: __ normal_iterator,std :: allocator >>,_ Allocator = std :: allocator,std :: allocator >>>,_Ch_type = char,_Rx_traits = std :: regex_traits]'已使用但从未定义过

当然,如果正则表达式只是GCC待办事项列表中的C++ 0x功能之一,我也不会感到惊讶,但在这种情况下,我为什么感到高兴呢?包含指令,变量声明等,并且仅在函数调用上跳过(它甚至似乎理解).

有什么我想念的吗?

Mic*_*urr 15

regex库大多没有在libstdc ++中实现,直到分支4.8.

版本4.9及更高版本确实已<regex>实现.

  • [`<regex>`现在从GCC 4.9开始实施](http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631#c17) (5认同)