Is there any native library in STL which is tested and works without any extra compiler options?
I tried to use <regex>, but the compiler outputs this:
In file included from /usr/include/c++/4.3/regex:40, from main.cpp:5:
/usr/include/c++/4.3/c++0x_warning.h:36:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
G++ 4.3 (and presumably later versions as well) is just being careful about the header files for maximum standards conformance.
If you’re programming in C++98 (the current standard that’s been around for a while), then regular expression support was added in tech report 1, and the and the header files are in a special
tr1directory, and the contents are in a special namespacestd::tr1.In the new C++0x standard, the regular expression support has been merged into the standard library, so it can be found in the header
regexand namespacestd.G++ makes sure that you use the right version for the
--std=version you specified on the command line, even though internally they’re both the same implementation.So to make regex work without switching to
--std=c++0x, just