¡@

Home 

c++ Programming Glossary: boost_static_assert

Restrict Template Function

http://stackoverflow.com/questions/148373/restrict-template-function

here edit as mentioned in the comments you can use BOOST_STATIC_ASSERT to make it a compile time check instead of a run time one share..

Limiting range of value types in C++

http://stackoverflow.com/questions/148511/limiting-range-of-value-types-in-c

int max2 LimitedValue const LimitedValue T min2 max2 other BOOST_STATIC_ASSERT min min2 BOOST_STATIC_ASSERT max max2 logic rest of code share..

Compile time sizeof_array without using a macro

http://stackoverflow.com/questions/1500363/compile-time-sizeof-array-without-using-a-macro

time ie I can't write enum ENUM N sizeof_array ARRAY or BOOST_STATIC_ASSERT sizeof_array ARRAY 10 Assuming the size 10.. Does anyone know..

How to write `is_complete` template?

http://stackoverflow.com/questions/1625105/how-to-write-is-complete-template

bool value sizeof T 0 ... so I could use it in such a way BOOST_STATIC_ASSERT boost is_complete T value The code above is not correct because..

What does static_assert do, and what would you use it for?

http://stackoverflow.com/questions/1647895/what-does-static-assert-do-and-what-would-you-use-it-for

regular assert ... Also in boost there is something called BOOST_STATIC_ASSERT is it the same as static_assert ... c debugging c 0x assert..

What is the best way of implementing assertion checking in C++?

http://stackoverflow.com/questions/179723/what-is-the-best-way-of-implementing-assertion-checking-in-c

asserts are pretty useful #include boost static_assert.hpp BOOST_STATIC_ASSERT sizeof int 4 compile fails if ints aren't 32 bit share improve..

C++ compile-time constant detection

http://stackoverflow.com/questions/3299834/c-compile-time-constant-detection

time and during runtime otherwise #define SUPER_ASSERT X BOOST_STATIC_ASSERT const_switch_uint X 1 assert X I'll look into that const_switch_xxx..

C++: nested class of a template class

http://stackoverflow.com/questions/4092237/c-nested-class-of-a-template-class

void g Nested typedef typename Nested outer argument TT BOOST_STATIC_ASSERT boost is_same typename A TT B Nested value struct NN typedef..

Boost Static Assertion for Type Comparision

http://stackoverflow.com/questions/6642050/boost-static-assertion-for-type-comparision

T struct IsSame T T typedef typename TrueType Result BOOST_STATIC_ASSERT IsSame Foo FooClass1 Foo FooClass1 Result value This static..

Ensuring C++ doubles are 64 bits

http://stackoverflow.com/questions/752309/ensuring-c-doubles-are-64-bits

. Would be like this char a sizeof double CHAR_BIT 64 or BOOST_STATIC_ASSERT sizeof double CHAR_BIT 64 You can find CHAR_BIT defined in limits.h..

C++ templates that accept only certain types

http://stackoverflow.com/questions/874298/c-templates-that-accept-only-certain-types

Traits library template typename T class ObservableList BOOST_STATIC_ASSERT is_base_of List T value Yes the double parentheses are needed..

Is there a way to prevent a class from being derived from twice using a static assert and type trait?

http://stackoverflow.com/questions/8851583/is-there-a-way-to-prevent-a-class-from-being-derived-from-twice-using-a-static-a

B public A class C public A class D public B public C BOOST_STATIC_ASSERT is_base_of_once A D value c multiple inheritance typetraits.. share improve this question The following should work BOOST_STATIC_ASSERT A D 0 0 If A exists twice this should rise an ambiguity error..