mirror of
https://github.com/boostorg/conversion.git
synced 2026-08-06 05:24:08 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fc4c6c156 | |||
| c68281b772 | |||
| 0a560dd543 | |||
| 8cbbd7c551 | |||
| 805d5df9cb | |||
| bd16c171e6 | |||
| 66235f4b9d | |||
| 8c18776800 |
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <climits>
|
||||
#include <cfloat> // for DBL_MAX (Peter Schmid)
|
||||
#include <boost/cast.hpp>
|
||||
|
||||
# if SCHAR_MAX == LONG_MAX
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace boost
|
||||
|
||||
// numeric_cast ------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS)
|
||||
|
||||
namespace detail
|
||||
{
|
||||
@@ -133,7 +133,7 @@ namespace boost
|
||||
template <class T>
|
||||
struct limits : std::numeric_limits<T>
|
||||
{
|
||||
static inline T min()
|
||||
static inline T min()
|
||||
# ifndef __GNUC__ // bug workaround courtesy Jens Maurer
|
||||
{
|
||||
return std::numeric_limits<T>::min() >= 0
|
||||
@@ -144,7 +144,7 @@ namespace boost
|
||||
# else
|
||||
;
|
||||
# endif
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# ifdef __GNUC__ // bug workaround courtesy Jens Maurer
|
||||
@@ -295,7 +295,7 @@ namespace boost
|
||||
typedef std::numeric_limits<Source> arg_traits;
|
||||
typedef detail::fixed_numeric_limits<Target> result_traits;
|
||||
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS)
|
||||
// typedefs that act as compile time assertions
|
||||
// (to be replaced by boost compile time assertions
|
||||
// as and when they become available and are stable)
|
||||
|
||||
@@ -13,11 +13,18 @@
|
||||
// where: tested with MSVC 6.0, BCC 5.5, and g++ 2.91
|
||||
|
||||
#include <boost/config.hpp>
|
||||
# ifndef BOOST_NO_STRINGSTREAM
|
||||
# include <sstream>
|
||||
# else
|
||||
# include <strstream>
|
||||
|
||||
// Some sstream implementations are broken for the purposes of lexical cast.
|
||||
# if defined(BOOST_NO_STRINGSTREAM)
|
||||
# define BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||
# endif
|
||||
|
||||
#ifdef BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||
# include <strstream>
|
||||
#else
|
||||
# include <sstream>
|
||||
#endif
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
namespace boost
|
||||
@@ -39,10 +46,10 @@ namespace boost
|
||||
template<typename Target, typename Source>
|
||||
Target lexical_cast(Source arg)
|
||||
{
|
||||
# ifndef BOOST_NO_STRINGSTREAM
|
||||
std::stringstream interpreter;
|
||||
# else
|
||||
# ifdef BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||
std::strstream interpreter; // for out-of-the-box g++ 2.95.2
|
||||
# else
|
||||
std::stringstream interpreter;
|
||||
# endif
|
||||
Target result;
|
||||
|
||||
@@ -54,14 +61,16 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright Kevlin Henney, 2000. All rights reserved.
|
||||
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose is hereby granted without fee, provided that this copyright and
|
||||
// permissions notice appear in all copies and derivatives, and that no
|
||||
// charge may be made for the software and its documentation except to cover
|
||||
// cost of distribution.
|
||||
// permissions notice appear in all copies and derivatives.
|
||||
//
|
||||
// This software is provided "as is" without express or implied warranty.
|
||||
|
||||
#ifdef BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||
# undef BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+7
-7
@@ -12,13 +12,13 @@
|
||||
<a href="../../boost/lexical_cast.hpp">boost/lexical_cast.hpp</a></h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="#motivation">Motivation</li>
|
||||
<li></a><a href="#examples">Examples</li>
|
||||
<li></a><a href="#synopsis">Synopsis</li>
|
||||
<li></a><a href="#lexical_cast"><code>lexical_cast</code></li>
|
||||
<li></a><a href="#bad_lexical_cast"><code>bad_lexical_cast</code></li>
|
||||
<li></a><a href="#portability">Portability</li>
|
||||
<li></a><a href="#future">Future directions</li>
|
||||
<li><a href="#motivation">Motivation</a></li>
|
||||
<li><a href="#examples">Examples</a></li>
|
||||
<li><a href="#synopsis">Synopsis</a></li>
|
||||
<li><a href="#lexical_cast"><code>lexical_cast</code></a></li>
|
||||
<li><a href="#bad_lexical_cast"><code>bad_lexical_cast</code></a></li>
|
||||
<li><a href="#portability">Portability</a></li>
|
||||
<li><a href="#future">Future directions</a></li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user