Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) BOOST_STATIC_ASSERT

 

BOOST_STATIC_ASSERT is a Boost macro to test assertions (that can be made at compile time) at compile time.

 

#include <boost/static_assert.hpp>

int main()
{
  BOOST_STATIC_ASSERT(16 * 16 == 256);
  BOOST_STATIC_ASSERT(sizeof(char) == 1);
}

 

 

 

 

 

C++11 Note for users of the C++11 standard

 

The C++11 standard has the keyword static_assert serving the same function.

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict