Jive reference manual
jem::CompileTimeCheck< Value > Class Template Reference

Checks a boolean condition at compile-time. More...

#include <jem/base/utilities.h>

Detailed Description

template<bool Value>
class jem::CompileTimeCheck< Value >

The CompileTimeCheck class enables one to check whether a boolean condition is true at compile-time, just as the traditional assert macro is used to verify a boolean condition at run-time. The CompileTimeCheck class has no members, but its specialization for template arguments evaluating to true has the static member check(), an inline member function that is empty.

The following example shows how to use this class:

enum { N = 1 };
// ...
CompileTimeCheck<(N > 1)>::check();

This example will only compile if the constant N is larger than zero. If it is not, the compiler will not be able to find the member function check, and the code will not compile.