2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-26 18:52:26 +00:00

Fix for compatibility with STLport using native iostreams

[SVN r8351]
This commit is contained in:
Dave Abrahams
2000-11-28 05:19:10 +00:00
parent 7f58e66754
commit c278310d1b

View File

@@ -2,7 +2,9 @@
#define OPERATORS_UK112000_H_
#include <boost/python/detail/functions.hpp>
#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 <sstream>
#else
# include <strstream>
@@ -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<operand>());
return BOOST_PYTHON_CONVERSION::to_python(s.str());
#else
std::ostrstream s;
s << BOOST_PYTHON_CONVERSION::from_python(args[0].get(), boost::python::type<operand>()) << 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<char const *>(s.str()));
#endif
}