Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++0x regex in GCC

Tags:

regex

gcc

c++11

The following code:

#include <regex>
using namespace std;

(snippage)

regex_search(s, m, re);

works in Microsoft C++, but GCC 4.4.3 gives the following error message:

/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]’ used but never defined

Of course it wouldn't surprise me if regex were simply one of the C++0x features still on the to-do list for GCC, but what I'm scratching my head over is, in that case, why does it happily take the include directive, variable declarations etc. and only trip over the function call (which it even seems to understand).

Is there something I'm missing?

like image 752
rwallace Avatar asked Jan 17 '11 18:01

rwallace


1 Answers

The regex library was mostly not implemented in libstdc++ up to branch 4.8.

Versions 4.9 and above do have <regex> implemented though.

  • Implementation tracker bug for <regex>
  • Current library support status for C++11
like image 80
Michael Burr Avatar answered Sep 18 '22 18:09

Michael Burr