How can I check for the decltype attribute?
I have a C ++ module that is compiled in both a C ++ 03 context and a C ++ 11 context. Compiling it as C ++ 11 I am using decltype
to find the type of a variable. In C ++ 03 I can (for my purposes) define decltype
as a macro in non-standard terms typeof
:
// add zero to get rid of const qualifier on the type
#define decltype(x) typeof((x) + 0)
Of course, I want to use the original decltype
one if available, and only define the macro if it's not available. How do I check for availability decltype
?
I tried #ifndef __cpp_decltype
as suggested at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3694.htm but it doesn't work.
source to share