From c278310d1b6b2bbe25d6a2fec944bde3ce07c231 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Tue, 28 Nov 2000 05:19:10 +0000 Subject: [PATCH] Fix for compatibility with STLport using native iostreams [SVN r8351] --- include/boost/python/operators.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/python/operators.hpp b/include/boost/python/operators.hpp index d0c06895..e76943e8 100644 --- a/include/boost/python/operators.hpp +++ b/include/boost/python/operators.hpp @@ -2,7 +2,9 @@ #define OPERATORS_UK112000_H_ #include -#if !defined(__GNUC__) || defined(__SGI_STL_PORT) +// When STLport is used with native streams, _STL::ostringstream().str() is not +// _STL::string, but std::string. +#if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__) # include #else # include @@ -473,17 +475,15 @@ namespace detail { tuple args(ref(arguments, ref::increment_count)); -#if !defined(__GNUC__) || defined(__SGI_STL_PORT) +// When STLport is used with native streams, _STL::ostringstream().str() is not +// _STL::string, but std::string. +#if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__) std::ostringstream s; s << BOOST_PYTHON_CONVERSION::from_python(args[0].get(), boost::python::type()); + return BOOST_PYTHON_CONVERSION::to_python(s.str()); #else std::ostrstream s; s << BOOST_PYTHON_CONVERSION::from_python(args[0].get(), boost::python::type()) << char(); -#endif - -#if !defined(__GNUC__) || defined(__SGI_STL_PORT) - return BOOST_PYTHON_CONVERSION::to_python(s.str()); -#else return BOOST_PYTHON_CONVERSION::to_python(const_cast(s.str())); #endif }