(C++) BOOST\STATIC\ASSERT

February 24, 2017 · View on GitHub

 

 

 

 

 

(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.

 

 

 

 

 

 

Contents

  1. 1int main() { BOOST_STATIC_ASSERT(16 * 16 == 256); BOOST_STATIC_ASSERT(sizeof(char) == 1); }"> #include &#x3C;boost/static_assert.hpp> int main() { BOOST_STATIC_ASSERT(16 * 16 == 256); BOOST_STATIC_ASSERT(sizeof(char) == 1); }
  2. 2Note for users of the C++11 standard