compile_assert

This is a compile time assert. This is a very basic version of this idea. Can be used to test assertions at compile time.

Listing: Example of compile_assert use
#include <ewl_utility>
 
template <class T>
T

foo(const T& t)
{
   Metrowerks::compile_assert<sizeof(T) >= sizeof(int)> 
T_Must_Be_At_Least_As_Big_As_int;
   //...
   return t;
}

int main()
{
   int i;
   foo(i); // ok
   char c;
   foo(c); // Error    : illegal use of incomplete struct/union/class
               //                'Metrowerks::compile_assert<0>'