File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed
include/boost/type_traits Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,8 @@ namespace boost{
5757 typedef integral_constant<T, val> type;
5858 static const T value = val;
5959
60- operator const mpl::integral_c<T, val>& ()const
61- {
62- static const char data[sizeof (long )] = { 0 };
63- static const void * pdata = data;
64- return *(reinterpret_cast <const mpl::integral_c<T, val>*>(pdata));
65- }
60+ BOOST_CONSTEXPR operator mpl::integral_c<T, val>()const
61+ { return mpl::integral_c<T, val>(); }
6662 BOOST_CONSTEXPR operator T ()const { return val; }
6763 };
6864
@@ -77,12 +73,8 @@ namespace boost{
7773 typedef integral_constant<bool , val> type;
7874 static const bool value = val;
7975
80- operator const mpl::bool_<val>& ()const
81- {
82- static const char data[sizeof (long )] = { 0 };
83- static const void * pdata = data;
84- return *(reinterpret_cast <const mpl::bool_<val>*>(pdata));
85- }
76+ BOOST_CONSTEXPR operator mpl::bool_<val>()const
77+ { return mpl::bool_<val>(); }
8678 BOOST_CONSTEXPR operator bool ()const { return val; }
8779 };
8880
Original file line number Diff line number Diff line change 55// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
66
77#include < boost/type_traits/is_void.hpp>
8+ #include < boost/mpl/bool.hpp>
9+ #include < boost/config.hpp>
810
911template <class T >
10- int dispatch_test_imp (const boost::mpl::bool_< true >& )
12+ BOOST_CONSTEXPR int dispatch_test_imp (boost::mpl::true_ )
1113{
1214 return 0 ;
1315}
1416template <class T >
15- int dispatch_test_imp (const boost::mpl::bool_< false >& )
17+ BOOST_CONSTEXPR int dispatch_test_imp (boost::mpl::false_ )
1618{
1719 return 1 ;
1820}
1921
2022template <class T >
21- int dispatch_test ()
23+ BOOST_CONSTEXPR int dispatch_test ()
2224{
2325 return dispatch_test_imp<T>(boost::is_void<T>());
2426}
2527
2628
2729int main ()
2830{
29- return (dispatch_test<int >() == 1 ) && (dispatch_test<void >() == 0 ) ? 0 : 1 ;
31+ BOOST_CONSTEXPR bool result = (dispatch_test<int >() == 1 ) && (dispatch_test<void >() == 0 );
32+ return result ? 0 : 1 ;
3033}
You can’t perform that action at this time.
0 commit comments