00001 #ifndef VRS_STATIC_ASSERT_H
00002 #define VRS_STATIC_ASSERT_H
00003
00004 #include <cassert>
00005
00006
00007
00008 namespace VRS {
00009 namespace STATIC_ASSERTION_NS {
00010 template <bool x> struct STATIC_ASSERTION_FAILURE;
00011 template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
00012 template<int x> struct STATIC_ASSERTION_TEST { };
00013 }
00014 }
00015
00016 #define VRS_STATIC_ASSERT(EXPR) \
00017 typedef ::VRS::STATIC_ASSERTION_NS::STATIC_ASSERTION_TEST< \
00018 sizeof(::VRS::STATIC_ASSERTION_NS::STATIC_ASSERTION_FAILURE< (bool)(EXPR) >) \
00019 > vrs_static_assert_typedef_
00020
00021 #endif // VRS_STATIC_ASSERT_H