SCM Repositories - boost


Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9, Wed Dec 20 08:01:48 2006 UTC revision 1.11, Sat Jan 20 13:16:40 2007 UTC
# Line 15  Line 15 
15  #include <boost/config.hpp>  #include <boost/config.hpp>
16  #include <boost/integer_traits.hpp>  #include <boost/integer_traits.hpp>
17    
18    #ifndef BOOST_NO_IS_ABSTRACT
19    // Fix for SF:1358600 - lexical_cast & pure virtual functions & VC 8 STL
20    #include <boost/mpl/if.hpp>
21    #include <boost/type_traits/is_abstract.hpp>
22    #endif
23    
24  #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS  #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
25  #include <boost/assert.hpp>  #include <boost/assert.hpp>
26  #else  #else
# Line 23  Line 29 
29    
30  namespace boost { namespace detail {  namespace boost { namespace detail {
31    
32    class lcast_abstract_stub {};
33    
34  #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS  #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
35  // Calculate an argument to pass to std::ios_base::precision from  // Calculate an argument to pass to std::ios_base::precision from
36  // lexical_cast. See alternative implementation for broken standard  // lexical_cast. See alternative implementation for broken standard
# Line 30  Line 38 
38  template<class T>  template<class T>
39  struct lcast_precision  struct lcast_precision
40  {  {
41      typedef std::numeric_limits<T> limits;  #ifdef BOOST_NO_IS_ABSTRACT
42        typedef std::numeric_limits<T> limits; // No fix for SF:1358600.
43    #else
44        typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
45            boost::is_abstract<T>
46          , std::numeric_limits<lcast_abstract_stub>
47          , std::numeric_limits<T>
48          >::type limits;
49    #endif
50    
51      BOOST_STATIC_CONSTANT(bool, use_default_precision =      BOOST_STATIC_CONSTANT(bool, use_default_precision =
52              !limits::is_specialized || limits::is_exact              !limits::is_specialized || limits::is_exact
# Line 80  Line 96 
96      return lcast_precision<T>::value;      return lcast_precision<T>::value;
97  #else // Follow lcast_precision algorithm at run-time:  #else // Follow lcast_precision algorithm at run-time:
98    
99      typedef std::numeric_limits<T> limits;  #ifdef BOOST_NO_IS_ABSTRACT
100        typedef std::numeric_limits<T> limits; // No fix for SF:1358600.
101    #else
102        typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
103            boost::is_abstract<T>
104          , std::numeric_limits<lcast_abstract_stub>
105          , std::numeric_limits<T>
106          >::type limits;
107    #endif
108    
109      bool const use_default_precision =      bool const use_default_precision =
110          !limits::is_specialized || limits::is_exact;          !limits::is_specialized || limits::is_exact;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.11