forked from boostorg/conversion
fixed lexical cast g++ sstream problem
[SVN r11592]
This commit is contained in:
@@ -13,11 +13,18 @@
|
|||||||
// where: tested with MSVC 6.0, BCC 5.5, and g++ 2.91
|
// where: tested with MSVC 6.0, BCC 5.5, and g++ 2.91
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
# ifndef BOOST_NO_STRINGSTREAM
|
|
||||||
# include <sstream>
|
// The GNU sstream implementation is broken for the purposes of lexical cast.
|
||||||
# else
|
# if defined(BOOST_NO_STRINGSTREAM) || (defined(__GNUC__) && !defined(__STL_USE_NEW_IOSTREAMS) || defined(__APPLE_CC__))
|
||||||
# include <strstream>
|
# define BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#ifdef BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||||
|
# include <strstream>
|
||||||
|
#else
|
||||||
|
# include <sstream>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -39,10 +46,10 @@ namespace boost
|
|||||||
template<typename Target, typename Source>
|
template<typename Target, typename Source>
|
||||||
Target lexical_cast(Source arg)
|
Target lexical_cast(Source arg)
|
||||||
{
|
{
|
||||||
# ifndef BOOST_NO_STRINGSTREAM
|
# ifdef BOOST_LEXICAL_CAST_USE_STRSTREAM
|
||||||
std::stringstream interpreter;
|
|
||||||
# else
|
|
||||||
std::strstream interpreter; // for out-of-the-box g++ 2.95.2
|
std::strstream interpreter; // for out-of-the-box g++ 2.95.2
|
||||||
|
# else
|
||||||
|
std::stringstream interpreter;
|
||||||
# endif
|
# endif
|
||||||
Target result;
|
Target result;
|
||||||
|
|
||||||
@@ -64,4 +71,8 @@ namespace boost
|
|||||||
//
|
//
|
||||||
// This software is provided "as is" without express or implied warranty.
|
// 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
|
#endif
|
||||||
|
Reference in New Issue
Block a user