Skip to content

Commit c278310

Browse files
committed
Fix for compatibility with STLport using native iostreams
[SVN r8351]
1 parent 7f58e66 commit c278310

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

include/boost/python/operators.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#define OPERATORS_UK112000_H_
33

44
#include <boost/python/detail/functions.hpp>
5-
#if !defined(__GNUC__) || defined(__SGI_STL_PORT)
5+
// When STLport is used with native streams, _STL::ostringstream().str() is not
6+
// _STL::string, but std::string.
7+
#if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__)
68
# include <sstream>
79
#else
810
# include <strstream>
@@ -473,17 +475,15 @@ namespace detail
473475
{
474476
tuple args(ref(arguments, ref::increment_count));
475477

476-
#if !defined(__GNUC__) || defined(__SGI_STL_PORT)
478+
// When STLport is used with native streams, _STL::ostringstream().str() is not
479+
// _STL::string, but std::string.
480+
#if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__)
477481
std::ostringstream s;
478482
s << BOOST_PYTHON_CONVERSION::from_python(args[0].get(), boost::python::type<operand>());
483+
return BOOST_PYTHON_CONVERSION::to_python(s.str());
479484
#else
480485
std::ostrstream s;
481486
s << BOOST_PYTHON_CONVERSION::from_python(args[0].get(), boost::python::type<operand>()) << char();
482-
#endif
483-
484-
#if !defined(__GNUC__) || defined(__SGI_STL_PORT)
485-
return BOOST_PYTHON_CONVERSION::to_python(s.str());
486-
#else
487487
return BOOST_PYTHON_CONVERSION::to_python(const_cast<char const *>(s.str()));
488488
#endif
489489
}

0 commit comments

Comments
 (0)