Go to the documentation of this file.
11 #ifndef STATIC_ASSERT_H
12 #define STATIC_ASSERT_H
23 #define STATIC_ASSERT(const_expression) static_assert(const_expression,#const_expression)
24 #define STATIC_ASSERT_ANNOTATED(const_expression,failReason) static_assert(const_expression,failReason)
29 template <
bool>
struct is;
30 template <>
struct is<
true> {
enum { value = 1 }; };
34 #define CA_UNIQUETYPE(typename) concatenate_pscans(typename,__LINE__)
35 #define COMPILE_ASSERTED_TYPE(const_expression) ::arb_compile_assertion::static_assert_test<sizeof(::arb_compile_assertion::is< (bool)( const_expression ) >)>
36 #define ASSERT_VIA_IS(type_definition,type_id) typedef type_definition type_id; struct concatenate(using_,type_id) { type_id instance; }
37 #define STATIC_ASSERT(const_expression) ASSERT_VIA_IS(COMPILE_ASSERTED_TYPE(const_expression), CA_UNIQUETYPE(_arb_compile_assertion_typedef_))
38 #define STATIC_ASSERT_ANNOTATED(const_expression,annotation) STATIC_ASSERT(const_expression)
43 #error static_assert.h included twice
44 #endif // STATIC_ASSERT_H