All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StaticAssert.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_STATICASSERT_H_
23 #define _BLAZE_UTIL_STATICASSERT_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <blaze/util/Suffix.h>
31 
32 
33 namespace blaze {
34 
35 //=================================================================================================
36 //
37 // COMPILE TIME ASSERTION
38 //
39 //=================================================================================================
40 
41 //*************************************************************************************************
90 //*************************************************************************************************
91 
92 
93 //*************************************************************************************************
103 template< int > struct STATIC_ASSERTION_TEST {};
105 //*************************************************************************************************
106 
107 
108 //*************************************************************************************************
118 template< bool > struct STATIC_ASSERTION_FAILED;
119 template<> struct STATIC_ASSERTION_FAILED<true> { enum { value = 1 }; };
121 //*************************************************************************************************
122 
123 
124 //*************************************************************************************************
130 #define BLAZE_STATIC_ASSERT(expr) \
131  typedef ::blaze::STATIC_ASSERTION_TEST< ::blaze::STATIC_ASSERTION_FAILED< (expr) != 0 >::value > \
132  BLAZE_JOIN( BLAZE_STATIC_ASSERTION_TYPEDEF, __LINE__ )
133 //*************************************************************************************************
134 
135 } // namespace blaze
136 
137 #endif