|
Boost : |
Subject: Re: [boost] [config] std::regex unusable on gcc?
From: Brian Ravnsgaard Riis (brian_at_[hidden])
Date: 2014-03-22 12:22:16
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2014-03-22 17:00, Andrey Semashev wrote:
> Hi,
>
> I'm trying to use std::regex and it's failing with even the
> simplest patterns:
>
> #include <regex>
>
> int main(int, char* argv[]) { std::regex rex("\\d"); return
> std::regex_match("1", rex); }
>
> g++ -std=c++11 rex_test.cpp -o rex_test ./rex_test terminate called
> after throwing an instance of 'std::regex_error' what():
> regex_error Aborted (core dumped)
>
> GCC version: gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9). GCC
> 4.7.3 exhibits the same behavior.
>
> Replacing "\\d" pattern with "[0-9]" results in the same failure.
> It works with Boost.Regex, Boost.Xpressive and with clang 3.4 &
> libc++. Am I doing something wrong?
>
> If my use of std::regex is correct then for me this basically means
> that std::regex is unusable. In this case, could we define
> BOOST_NO_CXX11_HDR_REGEX in Boost.Config for all versions of
> libstdc++?
The regex implementation in gcc's libstdc++ up to 4.8.x is incomplete.
To say the least! Rumour has it it'll be available in 4.9. Previous
versions implemented enough interface to compile, but it will not
actually work.
Stick with boost until 4.9 is available.
/Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJTLbiwAAoJEFES4N8QrEodoj4H/1lTlQp6S+/MKv8DtHkyPq6r
GXkZd6X1E3QZCTCZLeX43KwLp0ntr+ruO+PFE5XIikqUF5rBL37qC5WguGekXmXM
r5fp1HLBwnNY69AK82JFFhLp0XM/XEhRWzcTRnkX2zWFvX35oztH2+cFoz8zxAYf
yYJvt9duNdp3HYUalCyqJoz4E4vvRr4f/0lSve49zhRn176lltrIthvN4RZHPZhp
PogkxbLr1Dq6/4A9xBmV7AMGWvMMy8eQOs3QkXHUhs/OgQBEugihnWaUhtS2mN5b
c5sBN1w5EWezncReSTf1wAkPP0mSNeYxfxLk0b3CDGyEKAyoVJK/FnQjL5muhGo=
=6Arm
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk