diff --git a/include/boost/lexical_cast/detail/inf_nan.hpp b/include/boost/lexical_cast/detail/inf_nan.hpp index 5db7182..c48572e 100644 --- a/include/boost/lexical_cast/detail/inf_nan.hpp +++ b/include/boost/lexical_cast/detail/inf_nan.hpp @@ -29,12 +29,9 @@ #include #include +#include #include #include -#include -#if defined(_MSC_VER) && _MSC_VER < 1800 -# include -#endif #include @@ -50,40 +47,6 @@ namespace boost { return true; } - namespace lcast_math - { -#if defined(_MSC_VER) && _MSC_VER < 1800 - - template T copysign( T x, T y ) - { - return static_cast( _copysign( static_cast( x ), static_cast( y ) ) ); - } - - template bool isnan( T x ) - { - return _isnan( static_cast( x ) ) != 0; - } - - template bool isinf( T x ) - { - return ( _fpclass( static_cast( x ) ) & ( _FPCLASS_PINF | _FPCLASS_NINF ) ) != 0; - } - - template bool signbit( T x ) - { - return _copysign( 1.0, static_cast( x ) ) < 0.0; - } - -#else - - using ::copysign; // it is what it is - using std::isnan; - using std::isinf; - using std::signbit; - -#endif - } // namespace lcast_math - /* Returns true and sets the correct value if found NaN or Inf. */ template inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value @@ -114,7 +77,7 @@ namespace boost { } if( !has_minus ) value = std::numeric_limits::quiet_NaN(); - else value = lcast_math::copysign(std::numeric_limits::quiet_NaN(), static_cast(-1)); + else value = boost::core::copysign(std::numeric_limits::quiet_NaN(), static_cast(-1)); return true; } else if ( ( /* 'INF' or 'inf' */ @@ -142,8 +105,8 @@ namespace boost { , const CharT* lc_infinity) BOOST_NOEXCEPT { const CharT minus = lcast_char_constants::minus; - if (lcast_math::isnan(value)) { - if (lcast_math::signbit(value)) { + if (boost::core::isnan(value)) { + if (boost::core::signbit(value)) { *begin = minus; ++ begin; } @@ -151,8 +114,8 @@ namespace boost { std::memcpy(begin, lc_nan, 3 * sizeof(CharT)); end = begin + 3; return true; - } else if (lcast_math::isinf(value)) { - if (lcast_math::signbit(value)) { + } else if (boost::core::isinf(value)) { + if (boost::core::signbit(value)) { *begin = minus; ++ begin; }