Is there a way I can assert that two constant expressions are equal at compile time?
e.g. I want this to cause a compile-time error
enum { foo=263,
you can define your own static assertion , this way :
#include template class ClassStaticAssert; template <> class ClassStaticAssert{static const bool value = true;}; #define STATIC_ASSERT(e) (ClassStaticAssert()) int main() { STATIC_ASSERT(0); return 0; }