I have been trying to implement a method similar to static_assert
which is defined in the C++11 standard. The main problem is how does the C++ compiler write the text message being passed to static_assert
as a const char*
? I can get the compiler to write a message like A_is_not_POD
. This is what I have:
#define MY_STATIC_ASSERT(condition, name) \
typedef char name[(condition) ? 1 : -1];
But it would be quite nice to get the compiler to write something like "Error: A is not POD."
Any suggestions?