Silicium
explicit_operator_bool.hpp
Go to the documentation of this file.
1 #ifndef SILICIUM_EXPLICIT_OPERATOR_BOOL_HPP
2 #define SILICIUM_EXPLICIT_OPERATOR_BOOL_HPP
3 
4 #include <boost/version.hpp>
5 #if BOOST_VERSION >= 105500
6 # include <boost/utility/explicit_operator_bool.hpp>
7 #endif
8 
9 #ifdef BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT
10 //the noexcept version was added in 1.56 http://www.boost.org/doc/libs/1_57_0/libs/core/doc/html/core/explicit_operator_bool.html
11 # define SILICIUM_EXPLICIT_OPERATOR_BOOL() BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
12 
13 #elif defined(BOOST_EXPLICIT_OPERATOR_BOOL)
14 # define SILICIUM_EXPLICIT_OPERATOR_BOOL() BOOST_EXPLICIT_OPERATOR_BOOL()
15 
16 #else
17 # define SILICIUM_EXPLICIT_OPERATOR_BOOL() \
18  operator bool() const BOOST_NOEXCEPT \
19  { \
20  return !!(*this); \
21  }
22 #endif
23 
24 #endif