g ++ 4.3 (and, presumably, later versions) simply takes care of the header files for maximum compliance.
If you are programming in C ++ 98 (the current standard that has been around for a while), regular expression support has been added to technical report 1, and the header files are in the special directory tr1 , and the contents are in the special namespace std::tr1 .
In the new C ++ 0x standard, regular expression support has been integrated into a standard library, so it can be found in the regex header and in the std .
g ++ ensures that you are using the correct version for the --std= version that you specified on the command line, although internally they represent the same implementation.
So, to make the regex work without switching to --std=c++0x , just
#include <tr1/regex>
Ken bloom
source share