c++c++11

capture C++0x flag inside the program


Possible Duplicate:
GNU C++ how to check when -std=c++0x is in effect?

What I want to do is:

 #if defined(CPLUSPLUS_OXFLAG)
  //do something
 #else
  //do something else
 #endif

Now how can I capture -std=c++0x argument passed to the compiler(g++) to define my CPLUSPLUS_OXFLAG flag?


Solution

  • The GCC documentation states that the preprocessor symbol __GXX_EXPERIMENTAL_CXX0X__ is defined when compiling with -std=c++0x.