1 /* 2 Copyright 2014-2016 Glen Joseph Fernandes 3 ([email protected]) 4 5 Distributed under the Boost Software License, Version 1.0. 6 (http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 #ifndef BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP 9 #define BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP 10 11 #include <boost/config.hpp> 12 13 #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) 14 #include <type_traits> 15 #endif 16 17 namespace boost { 18 namespace alignment { 19 namespace detail { 20 21 #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) 22 using std::integral_constant; 23 using std::true_type; 24 using std::false_type; 25 #else 26 template<class T, T Value> 27 struct integral_constant { 28 typedef T value_type; 29 typedef integral_constant type; 30 31 BOOST_CONSTEXPR operator value_type() const BOOST_NOEXCEPT { 32 return Value; 33 } 34 35 BOOST_CONSTEXPR value_type operator()() const BOOST_NOEXCEPT { 36 return Value; 37 } 38 39 BOOST_STATIC_CONSTEXPR T value = Value; 40 }; 41 42 template<class T, T Value> 43 BOOST_CONSTEXPR_OR_CONST T integral_constant<T, Value>::value; 44 45 typedef integral_constant<bool, true> true_type; 46 typedef integral_constant<bool, false> false_type; 47 #endif 48 49 } /* detail */ 50 } /* alignment */ 51 } /* boost */ 52 53 #endif 54