template<bool ASSERTION, class TYPE = Unspecified>
class Constraint< ASSERTION, TYPE >
Compile-time constraint.
Use this class to force an error at compile-time if the given expression evaluates to false.
class MyClass {
public:
enum {
MY_ERROR
};
void myMethod()
{
if (
Constraint<
sizeof(
unsigned int) ==
sizeof(
unsigned long)>::UNSPECIFIED);
...
if (
Constraint<
sizeof(
unsigned int) ==
sizeof(
unsigned long), MyClass>::MY_ERROR);
...
}
};