diff --git a/include/boost/cast.hpp b/include/boost/cast.hpp index 1a5b9dc..bf5c77c 100644 --- a/include/boost/cast.hpp +++ b/include/boost/cast.hpp @@ -48,6 +48,7 @@ # include # include # include +# include // It has been demonstrated numerous times that MSVC 6.0 fails silently at link // time if you use a template function which has template parameters that don't @@ -125,52 +126,25 @@ namespace boost namespace detail { - template struct numeric_min_select; - - template<> - struct numeric_min_select - { - template - struct limits : std::numeric_limits - { + template + struct signed_numeric_limits : std::numeric_limits + { static inline T min() -# ifndef __GNUC__ // bug workaround courtesy Jens Maurer - { - return std::numeric_limits::min() >= 0 + { + return std::numeric_limits::min() >= 0 // unary minus causes integral promotion, thus the static_cast<> ? static_cast(-std::numeric_limits::max()) : std::numeric_limits::min(); - } -# else - ; -# endif }; - }; - -# ifdef __GNUC__ // bug workaround courtesy Jens Maurer - template<> template - inline T numeric_min_select::limits::min() - { - return std::numeric_limits::min() >= 0 - // unary minus causes integral promotion, thus the static_cast<> - ? static_cast(-std::numeric_limits::max()) - : std::numeric_limits::min(); - } -# endif - - template<> - struct numeric_min_select - { - template - struct limits : std::numeric_limits {}; }; - + // Move to namespace boost in utility.hpp? template struct fixed_numeric_limits_base - : public numeric_min_select< - std::numeric_limits::is_signed - >::template limits + : public if_true< std::numeric_limits::is_signed > + ::template then< signed_numeric_limits, + std::numeric_limits + >::type {}; template