strusBase  0.17
enable_if.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 #ifndef _STRUS_BASE_ENABLE_IF_HPP_INCLUDED
10 #define _STRUS_BASE_ENABLE_IF_HPP_INCLUDED
11 
13 #if defined __GNUC__
14 #define STRUS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
15 #endif
16 
17 #undef STRUS_USE_STD_ENABLE_IF
18 #if __cplusplus >= 201103L
19 #if defined __clang__
20 #define STRUS_USE_STD_ENABLE_IF
21 #elif defined __GNUC__
22 #if STRUS_GCC_VERSION >= 40900
23 #define STRUS_USE_STD_ENABLE_IF
24 #endif // STRUS_GCC_VERSION
25 #endif // __clang__
26 #endif // __cplusplus
27 
28 #if defined STRUS_USE_STD_ENABLE_IF
29 #include <type_traits>
30 namespace strus {
31 template< bool B, class T = void >
32 struct enable_if :public std::enable_if<B,T> {};
33 }//namespace
34 
35 #else //STRUS_USE_STD_ENABLE_IF
36 
37 #include <boost/utility.hpp>
38 #include <boost/type_traits.hpp>
39 
40 namespace strus {
41 template< bool B, class T = void >
42 struct enable_if :public boost::enable_if_c<B,T>{};
43 }//namespace
44 
45 #endif //STRUS_USE_STD_ENABLE_IF
46 
47 #endif
48 
Definition: enable_if.hpp:42