StaticAssert.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_STATICASSERT_H_
36 #define _BLAZE_UTIL_STATICASSERT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/util/Suffix.h>
44 
45 
46 namespace blaze {
47 
48 //=================================================================================================
49 //
50 // COMPILE TIME ASSERTION
51 //
52 //=================================================================================================
53 
54 //*************************************************************************************************
103 //*************************************************************************************************
104 
105 
106 //*************************************************************************************************
116 template< int > struct STATIC_ASSERTION_TEST {};
118 //*************************************************************************************************
119 
120 
121 //*************************************************************************************************
131 template< bool > struct STATIC_ASSERTION_FAILED;
132 template<> struct STATIC_ASSERTION_FAILED<true> { enum { value = 1 }; };
134 //*************************************************************************************************
135 
136 
137 //*************************************************************************************************
143 #define BLAZE_STATIC_ASSERT(expr) \
144  typedef ::blaze::STATIC_ASSERTION_TEST< ::blaze::STATIC_ASSERTION_FAILED< (expr) != 0 >::value > \
145  BLAZE_JOIN( BLAZE_STATIC_ASSERTION_TYPEDEF, __LINE__ )
146 //*************************************************************************************************
147 
148 } // namespace blaze
149 
150 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for compile time constraints.