1 | // ================================================================ // |
---|
2 | // // |
---|
3 | // File : cxxforward.h // |
---|
4 | // Purpose : macros for forward usage of C++11 features // |
---|
5 | // w/o loosing compatibility to C++03 compilers // |
---|
6 | // // |
---|
7 | // Coded by Ralf Westram (coder@reallysoft.de) in December 2012 // |
---|
8 | // Institute of Microbiology (Technical University Munich) // |
---|
9 | // http://www.arb-home.de/ // |
---|
10 | // // |
---|
11 | // ================================================================ // |
---|
12 | |
---|
13 | #ifndef CXXFORWARD_H |
---|
14 | #define CXXFORWARD_H |
---|
15 | |
---|
16 | #ifndef GCCVER_H |
---|
17 | #include "gccver.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #if defined(__cplusplus) |
---|
21 | # if (GCC_VERSION_CODE >= 407) |
---|
22 | # if (__cplusplus == 199711L) |
---|
23 | # else |
---|
24 | # if (__cplusplus == 201103L) |
---|
25 | # define ARB_ENABLE_Cxx11_FEATURES |
---|
26 | # else |
---|
27 | # error Unknown C++ standard defined in __cplusplus |
---|
28 | # endif |
---|
29 | # endif |
---|
30 | # endif |
---|
31 | #else |
---|
32 | # warning C compilation includes cxxforward.h |
---|
33 | #endif |
---|
34 | |
---|
35 | |
---|
36 | #ifdef ARB_ENABLE_Cxx11_FEATURES |
---|
37 | |
---|
38 | // C++11 is enabled starting with gcc 4.7 in ../Makefile@USE_Cxx11 |
---|
39 | // |
---|
40 | // Full support for C++11 is available starting with gcc 4.8. |
---|
41 | // Use #ifdef Cxx11 to insert conditional sections using full C++11 |
---|
42 | # if (GCC_VERSION_CODE >= 408) |
---|
43 | # define Cxx11 1 |
---|
44 | # endif |
---|
45 | |
---|
46 | // allows static member initialisation in class definition: |
---|
47 | # define CONSTEXPR constexpr |
---|
48 | # define CONSTEXPR_RETURN constexpr |
---|
49 | |
---|
50 | // allows to protect overloading functions against signature changes of overload functions: |
---|
51 | # define OVERRIDE override |
---|
52 | |
---|
53 | #else |
---|
54 | // backward (non C++11) compatibility defines: |
---|
55 | # define CONSTEXPR const |
---|
56 | # define CONSTEXPR_RETURN |
---|
57 | # define OVERRIDE |
---|
58 | |
---|
59 | #endif |
---|
60 | |
---|
61 | #else |
---|
62 | #error cxxforward.h included twice |
---|
63 | #endif // CXXFORWARD_H |
---|