MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StaticAssert.hpp
Go to the documentation of this file.
1 #ifndef STATIC_ASSERT_H
2 #define STATIC_ASSERT_H
3 
9 namespace mgx {
10 namespace util {
11 // Extracted from boost static_asset.h ...
12 template <bool x> struct STATIC_ASSERTION_FAILURE;
13 template <> struct STATIC_ASSERTION_FAILURE<true> {
14  enum { value = 1 };
15 };
16 template <int x> struct static_assert_test {
17 };
18 
19 #define _MGX_JOIN(X, Y) _MGX_DO_JOIN(X, Y)
20 #define _MGX_DO_JOIN(X, Y) _MGX_DO_JOIN2(X, Y)
21 #define _MGX_DO_JOIN2(X, Y) X ## Y
22 
47 #define STATIC_ASSERT(B) \
48  typedef mgx::util::static_assert_test<sizeof(mgx::util::STATIC_ASSERTION_FAILURE<(bool)(B)>)> \
49  _MGX_JOIN (static_assert_typedef_, __LINE__)
50 } // namespace util
51 } // namespace mgx
52 #endif // STATIC_ASSERT_H
Definition: StaticAssert.hpp:16
Definition: StaticAssert.hpp:12