Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
static_assert.h
Go to the documentation of this file.
1 /// @file Pb/detail/static_assert.h
2 /// Tests for compiler support for static_assert.
3 ///
4 /// The MIT License(MIT)
5 /// @copyright 2014 Paul M Watt
6 // ****************************************************************************
7 #ifndef STATIC_ASSERT_H_INCLUDED
8 #define STATIC_ASSERT_H_INCLUDED
9 // Includes *******************************************************************
10 #include <utility>
11 #include <type_traits>
12 
13 // static assert supported in these compilers:
14 #if _MSC_VER >= 1600
15 
16 # define ALCHEMY_STATIC_ASSERT_SUPPORTED 1
17 
18 // Test for GCC > 4.3.0
19 #elif __GNUC__ > 4 || \
20  (__GNUC__ == 4 && (__GNUC_MINOR__ > 3 || \
21  (__GNUC_MINOR__ == 3 && \
22  __GNUC_PATCHLEVEL__ > 0)))
23 # define ALCHEMY_STATIC_ASSERT_SUPPORTED 1
24 
25 #else
26 
27 # define ALCHEMY_STATIC_ASSERT_SUPPORTED 0
28 
29 # ifndef static_assert
30 // The Compiler does not support static assert
31 // implementing an empty MACRO for now.
32 # define static_assert(expr, msg)
33 
34 # endif
35 
36 #endif // Static_assert support
37 
38 
39 
40 #endif