From 258c80886aa987cb3d3b655f84c9cd90b6f45085 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 28 Feb 2015 16:55:32 +0000 Subject: [PATCH] Add some namespace prefixes to avoid ambiguities. --- include/boost/type_traits/decay.hpp | 2 +- .../boost/type_traits/integral_constant.hpp | 18 +++++++++++++++--- include/boost/type_traits/is_signed.hpp | 2 +- include/boost/type_traits/is_unsigned.hpp | 2 +- .../boost/type_traits/type_with_alignment.hpp | 14 +++++++------- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/boost/type_traits/decay.hpp b/include/boost/type_traits/decay.hpp index a7e8321..5b57fda 100644 --- a/include/boost/type_traits/decay.hpp +++ b/include/boost/type_traits/decay.hpp @@ -33,7 +33,7 @@ namespace boost private: typedef typename remove_reference::type Ty; public: - typedef typename detail::decay_imp::value, boost::is_function::value>::type type; + typedef typename boost::detail::decay_imp::value, boost::is_function::value>::type type; }; } // namespace boost diff --git a/include/boost/type_traits/integral_constant.hpp b/include/boost/type_traits/integral_constant.hpp index 0a160b5..aa23eee 100644 --- a/include/boost/type_traits/integral_constant.hpp +++ b/include/boost/type_traits/integral_constant.hpp @@ -55,11 +55,17 @@ namespace boost{ typedef T value_type; typedef integral_constant type; static const T value = val; + // + // This helper function is just to disable type-punning + // warnings from GCC: + // + template + static T& dereference(T* p) { return *p; } operator const mpl::integral_c& ()const { - static const char data = 0; - return *reinterpret_cast*>(&data); + static const char data[sizeof(long)] = { 0 }; + return dereference(reinterpret_cast*>(&data)); } BOOST_CONSTEXPR operator T() { return val; } }; @@ -73,11 +79,17 @@ namespace boost{ typedef mpl::integral_c_tag tag; typedef integral_constant type; static const bool value = val; + // + // This helper function is just to disable type-punning + // warnings from GCC: + // + template + static T& dereference(T* p) { return *p; } operator const mpl::bool_& ()const { static const char data = 0; - return *reinterpret_cast*>(&data); + return dereference(reinterpret_cast*>(&data)); } BOOST_CONSTEXPR operator bool() { return val; } }; diff --git a/include/boost/type_traits/is_signed.hpp b/include/boost/type_traits/is_signed.hpp index b668313..2d0afac 100644 --- a/include/boost/type_traits/is_signed.hpp +++ b/include/boost/type_traits/is_signed.hpp @@ -66,7 +66,7 @@ struct is_signed_select_helper template struct is_signed { - typedef detail::is_signed_select_helper< ::boost::is_integral::value || ::boost::is_enum::value> selector; + typedef ::boost::detail::is_signed_select_helper< ::boost::is_integral::value || ::boost::is_enum::value> selector; typedef typename selector::template rebind binder; typedef typename binder::type type; BOOST_STATIC_CONSTANT(bool, value = type::value); diff --git a/include/boost/type_traits/is_unsigned.hpp b/include/boost/type_traits/is_unsigned.hpp index 8e83a33..309f3ed 100644 --- a/include/boost/type_traits/is_unsigned.hpp +++ b/include/boost/type_traits/is_unsigned.hpp @@ -66,7 +66,7 @@ struct is_unsigned_select_helper template struct is_unsigned { - typedef detail::is_unsigned_select_helper< ::boost::is_integral::value || ::boost::is_enum::value > selector; + typedef ::boost::detail::is_unsigned_select_helper< ::boost::is_integral::value || ::boost::is_enum::value > selector; typedef typename selector::template rebind binder; typedef typename binder::type type; BOOST_STATIC_CONSTANT(bool, value = type::value); diff --git a/include/boost/type_traits/type_with_alignment.hpp b/include/boost/type_traits/type_with_alignment.hpp index 56ed4c4..3fbb213 100644 --- a/include/boost/type_traits/type_with_alignment.hpp +++ b/include/boost/type_traits/type_with_alignment.hpp @@ -50,7 +50,7 @@ namespace boost { }; template struct long_double_alignment{ typedef long double type; }; -template struct long_double_alignment{ typedef detail::max_align type; }; +template struct long_double_alignment{ typedef boost::detail::max_align type; }; template struct double_alignment{ typedef double type; }; template struct double_alignment{ typedef typename long_double_alignment::value >= Target>::type type; }; @@ -81,7 +81,7 @@ template struct char_alignment{ typedef type template struct type_with_alignment { - typedef typename detail::char_alignment::value >= Align>::type type; + typedef typename boost::detail::char_alignment::value >= Align>::type type; }; #if defined(__GNUC__) && !defined(BOOST_TT_DISABLE_INTRINSICS) @@ -159,7 +159,7 @@ template<> struct type_with_alignment<8> typedef boost::conditional< ::boost::alignment_of::value < 8, tt_align_ns::a8, - detail::char_alignment<8, false> >::type t1; + boost::detail::char_alignment<8, false> >::type t1; public: typedef t1::type type; }; @@ -168,7 +168,7 @@ template<> struct type_with_alignment<16> typedef boost::conditional< ::boost::alignment_of::value < 16, tt_align_ns::a16, - detail::char_alignment<16, false> >::type t1; + boost::detail::char_alignment<16, false> >::type t1; public: typedef t1::type type; }; @@ -177,7 +177,7 @@ template<> struct type_with_alignment<32> typedef boost::conditional< ::boost::alignment_of::value < 32, tt_align_ns::a32, - detail::char_alignment<32, false> >::type t1; + boost::detail::char_alignment<32, false> >::type t1; public: typedef t1::type type; }; @@ -185,7 +185,7 @@ template<> struct type_with_alignment<64> { typedef boost::conditional< ::boost::alignment_of::value < 64, tt_align_ns::a64, - detail::char_alignment<64, false> >::type t1; + boost::detail::char_alignment<64, false> >::type t1; public: typedef t1::type type; }; @@ -193,7 +193,7 @@ template<> struct type_with_alignment<128> { typedef boost::conditional< ::boost::alignment_of::value < 128, tt_align_ns::a128, - detail::char_alignment<128, false> >::type t1; + boost::detail::char_alignment<128, false> >::type t1; public: typedef t1::type type; };