0

As in the title,

is there a C++ preprocessor #define that defines the C++ version being compiled? Like a compile with clang++ -std=c++11 produces a define __CPP_VERSION or whatever.

The possible duplicate at How to determine the version of the C++ standard used by the compiler? is inaccurate.

oconnor0
  • 3,154
  • 6
  • 34
  • 52
  • 4
    https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html –  Aug 29 '17 at 21:40
  • http://en.cppreference.com/w/cpp/preprocessor/replace says that C++ defines a `__cplusplus` preprocessor macro with a specific number for a given C++ version. – oconnor0 Aug 29 '17 at 22:07
  • In practice you have a problem when a compiler implements 99.9% of C++xx, but one feature is missing. What should the defined value be? Does your code *really care* if [reference_wrapper is trivially copyable](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4277.html)? – Bo Persson Aug 29 '17 at 22:16

0 Answers0