Base Framework
Constraint< ASSERTION, TYPE > Class Template Reference

Compile-time constraint. More...

#include <base/Base.h>

Detailed Description

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);
...
}
};
Constraint
Compile-time constraint.
Definition: Base.h:313