What flavor of does C++11 support

M

Melzzzzz

This is starting to sound rather unlikely ... care to cite any
references?

The web page I found at gcc.org which claimed "no support at all for
std::regex" was obviously wrong. And now that I bothered to check my
own system, I see that even libstdc++ 4.6 is shock full of regex
implementation.

/Jorgen

bmaxa@maxa:~/examples$ cat regex.cpp
//Example 1
#include <iostream>
#include <regex>
#include <string>

using namespace std;

int main()
{
string input;
regex integer("(\\+|-)?[[:digit:]]+");
//As long as the input is correct ask for another number
while(true)
{
cout<<"Give me an integer!"<<endl;
cin>>input;
//Exit when the user inputs q
if(input=="q")
break;
if(regex_match(input,integer))
cout<<"integer"<<endl;
else
{
cout<<"Invalid input"<<endl;
}
}
}
bmaxa@maxa:~/examples$ g++ -std=c++11 regex.cpp -o regex
bmaxa@maxa:~/examples$ ./regex
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
Aborted (core dumped)
bmaxa@maxa:~/examples$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)

Does not work...
 
W

woodbrian77

Sure it does matter. There is a mountain of difference if you can just
rely on your code to working on all platforms with the standard C++
implementation, or you must take care of downloading, compiling,
integrating into the build process, porting and/or upgrading the library
when adding platforms or changing to a newer compiler version, etc, etc.

I'm not sure why it's a problem, but I find it's like
pulling teeth to get someone to download and build
my software. I tried for a month or more and got
one person to take me up on it.

https://groups.google.com/forum/#!topic/comp.lang.c++/3A_QW2Dh-sU

I'm happy to port to another platform if someone
is interested in trying it out on that platform.

Brian
Ebenezer Enterprises - So far G-d has helped us.
http://webEbenezer.net
 
W

woodbrian77

You might get more interest if you actually explain what it does, or why
someone would want to use it. A request to try compiling some code, of
unknown purpose, doesn't really sound very exciting.

My website explains it, but I may not have in that
post/thread. The C++ Middleware Writer is an on line
alternative to serialization libraries. I believe
everything these guys

http://springfuse.com

say in terms of marketing their java code generator is
also true of the C++ Middleware Writer. They are kind
of my marketing team.

And to clarify my earlier comment, only one person
reported results, but there were dozens of downloads.
 
K

kurt krueckeberg

bmaxa@maxa:~/examples$ cat regex.cpp
//Example 1

#include <iostream>

#include <regex>

#include <string>

using namespace std;
int main()

{

string input;

regex integer("(\\+|-)?[[:digit:]]+");

// snip
bmaxa@maxa:~/examples$ g++ -std=c++11 regex.cpp -o regex

bmaxa@maxa:~/examples$ ./regex

terminate called after throwing an instance of 'std::regex_error'

what(): regex_error

Aborted (core dumped)

bmaxa@maxa:~/examples$ g++ -v

Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4..7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

Thread model: posix

gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)



Does not work...


If the default regex flavor for std:regex ECMAScript, which I believe does not support POSIX character classes, then

regex integer("(\\+|-)?[[:digit:]]+");

needs to be written as

regex integer("(\\+|-)?\\d+");

However, even with this correction, the line still blows up.
 
M

Melzzzzz

bmaxa@maxa:~/examples$ cat regex.cpp

//Example 1

#include <iostream>

#include <regex>

#include <string>

using namespace std;
int main()

{

string input;

regex integer("(\\+|-)?[[:digit:]]+");

// snip
bmaxa@maxa:~/examples$ g++ -std=c++11 regex.cpp -o regex

bmaxa@maxa:~/examples$ ./regex

terminate called after throwing an instance of 'std::regex_error'

what(): regex_error

Aborted (core dumped)

bmaxa@maxa:~/examples$ g++ -v

Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v
--with-pkgversion='Ubuntu/Linaro 4.7.3-1ubuntu1'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --with-system-zlib --enable-objc-gc --with-cloog
--enable-cloog-backend=ppl --disable-cloog-version-check
--disable-ppl-version-check --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu

Thread model: posix

gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)



Does not work...


If the default regex flavor for std:regex ECMAScript, which I believe
does not support POSIX character classes, then

regex integer("(\\+|-)?[[:digit:]]+");

needs to be written as

regex integer("(\\+|-)?\\d+");

However, even with this correction, the line still blows up.

Clang's libc++ have regex implemented while ago. Seems to accept
both variants of that regex.

bmaxa@maxa:~/examples$ g++ -std=c++11 -I/usr/include/c++/v1 regex.cpp -o regex -lc++
bmaxa@maxa:~/examples$ ./regex
Give me an integer!
45
integer
Give me an integer!
rt
Invalid input
Give me an integer!
q
 
M

Melzzzzz

On Tue, 1 Oct 2013 00:10:19 +0200


Finally, g++ 4.9 from trunk have regex implemented ;)

bmaxa@maxa:~/examples$ g++-trunk -std=c++11 regex.cpp -Wl,-rpath,/opt/gcc-trunk/lib64 -o regex
bmaxa@maxa:~/examples$ ./regex
Give me an integer!
4
integer
Give me an integer!
r
Invalid input
Give me an integer!
q
bmaxa@maxa:~/examples$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/opt/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/opt/gcc-trunk CFLAGS='-O3 -march=native' CXXFLAGS='-O3 -march=native' --enable-languages=c,c++ --program-suffix=-trunk
Thread model: posix
gcc version 4.9.0 20131015 (experimental) (GCC)
bmaxa@maxa:~/examples$
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top