mirror of
https://github.com/boostorg/conversion.git
synced 2025-08-05 15:34:29 +02:00
Fix [ 1358600 ] lexical_cast & pure virtual functions & VC 8 STL
[SVN r36739]
This commit is contained in:
@@ -15,6 +15,10 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/integer_traits.hpp>
|
#include <boost/integer_traits.hpp>
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) // VC++ 8.0
|
||||||
|
#include <boost/type_traits/is_abstract.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#else
|
#else
|
||||||
@@ -23,6 +27,27 @@
|
|||||||
|
|
||||||
namespace boost { namespace detail {
|
namespace boost { namespace detail {
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
|
||||||
|
|
||||||
|
template<class T, bool IsAbstract> struct lcast_msvc_limits;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct lcast_msvc_limits<T,false>
|
||||||
|
: std::numeric_limits<T>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Non-abstract class that does define a specialization of numeric_limits:
|
||||||
|
class lcast_msvc_without_limits {};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct lcast_msvc_limits<T,true>
|
||||||
|
: std::numeric_limits<lcast_msvc_without_limits>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VC++ workaround
|
||||||
|
|
||||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||||
// Calculate an argument to pass to std::ios_base::precision from
|
// Calculate an argument to pass to std::ios_base::precision from
|
||||||
// lexical_cast. See alternative implementation for broken standard
|
// lexical_cast. See alternative implementation for broken standard
|
||||||
@@ -30,7 +55,11 @@ namespace boost { namespace detail {
|
|||||||
template<class T>
|
template<class T>
|
||||||
struct lcast_precision
|
struct lcast_precision
|
||||||
{
|
{
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
|
||||||
|
typedef lcast_msvc_limits<T, (boost::is_abstract<T>::value)> limits;
|
||||||
|
#else
|
||||||
typedef std::numeric_limits<T> limits;
|
typedef std::numeric_limits<T> limits;
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOST_STATIC_CONSTANT(bool, use_default_precision =
|
BOOST_STATIC_CONSTANT(bool, use_default_precision =
|
||||||
!limits::is_specialized || limits::is_exact
|
!limits::is_specialized || limits::is_exact
|
||||||
|
Reference in New Issue
Block a user