diff --git a/include/boost/type_traits/integral_constant.hpp b/include/boost/type_traits/integral_constant.hpp index 164cb11..1b36dbd 100644 --- a/include/boost/type_traits/integral_constant.hpp +++ b/include/boost/type_traits/integral_constant.hpp @@ -56,17 +56,12 @@ 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 U& dereference(U* p) { return *p; } operator const mpl::integral_c& ()const { static const char data[sizeof(long)] = { 0 }; - return dereference(reinterpret_cast*>(&data)); + static const void* pdata = data; + return *(reinterpret_cast*>(pdata)); } BOOST_CONSTEXPR operator T()const { return val; } }; @@ -81,17 +76,12 @@ namespace boost{ typedef bool value_type; 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 dereference(reinterpret_cast*>(&data)); + static const char data[sizeof(long)] = { 0 }; + static const void* pdata = data; + return *(reinterpret_cast*>(pdata)); } BOOST_CONSTEXPR operator bool()const { return val; } };