CompileTimeChecker.h File Reference
Macro to check for compile time error ("Modern C++ Design" by A. Alexandrescu, slightly modified to comply with TC2006).
More...
|
Classes |
struct | CompileTimeChecker< bool > |
struct | CompileTimeChecker< false > |
Defines |
#define | STATIC_CHECK(expr, msg) |
Detailed Description
Macro to check for compile time error ("Modern C++ Design" by A. Alexandrescu, slightly modified to comply with TC2006).
- Note:
- Usage: STATIC_CHECK(expression, Error_Description); i.e. STATIC_CHECK(sizeof(From) <= sizeof(To), Destination_Type_Too_Narrow);
Define Documentation
#define STATIC_CHECK |
( |
expr, |
|
|
msg |
|
) |
|
Value:
{\
class ERROR_##msg {};\
(void)sizeof(CompileTimeChecker<(expr) != 0>(&ERROR_##msg()));\
}