Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85498 - in trunk: boost libs/rational/test
From: dwalker07_at_[hidden]
Date: 2013-08-28 03:12:48


Author: dlwalker
Date: 2013-08-28 03:12:48 EDT (Wed, 28 Aug 2013)
New Revision: 85498
URL: http://svn.boost.org/trac/boost/changeset/85498

Log:
Make the I/O part of Boost.Rational conditional on the configuration flag BOOST_NO_IOSTREAM (refs #7250).

Text files modified:
   trunk/boost/rational.hpp | 9 +++++++--
   trunk/libs/rational/test/rational_test.cpp | 2 ++
   2 files changed, 9 insertions(+), 2 deletions(-)

Modified: trunk/boost/rational.hpp
==============================================================================
--- trunk/boost/rational.hpp Wed Aug 28 02:38:30 2013 (r85497)
+++ trunk/boost/rational.hpp 2013-08-28 03:12:48 EDT (Wed, 28 Aug 2013) (r85498)
@@ -59,14 +59,17 @@
 #ifndef BOOST_RATIONAL_HPP
 #define BOOST_RATIONAL_HPP
 
-#include <iostream> // for std::istream and std::ostream
+#include <boost/config.hpp> // for BOOST_NO_STDC_NAMESPACE, BOOST_MSVC, etc
+#ifndef BOOST_NO_IOSTREAM
 #include <ios> // for std::noskipws
+#include <istream> // for std::istream
+#include <ostream> // for std::ostream
+#endif
 #include <stdexcept> // for std::domain_error
 #include <string> // for std::string implicit constructor
 #include <boost/operators.hpp> // for boost::addable etc
 #include <cstdlib> // for std::abs
 #include <boost/call_traits.hpp> // for boost::call_traits
-#include <boost/config.hpp> // for BOOST_NO_STDC_NAMESPACE, BOOST_MSVC, etc
 #include <boost/detail/workaround.hpp> // for BOOST_WORKAROUND
 #include <boost/assert.hpp> // for BOOST_ASSERT
 #include <boost/math/common_factor_rt.hpp> // for boost::math::gcd, lcm
@@ -568,6 +571,7 @@
     BOOST_ASSERT( this->test_invariant() );
 }
 
+#ifndef BOOST_NO_IOSTREAM
 namespace detail {
 
     // A utility class to reset the format flags for an istream at end
@@ -615,6 +619,7 @@
     os << r.numerator() << '/' << r.denominator();
     return os;
 }
+#endif // BOOST_NO_IOSTREAM
 
 // Type conversion
 template <typename T, typename IntType>

Modified: trunk/libs/rational/test/rational_test.cpp
==============================================================================
--- trunk/libs/rational/test/rational_test.cpp Wed Aug 28 02:38:30 2013 (r85497)
+++ trunk/libs/rational/test/rational_test.cpp 2013-08-28 03:12:48 EDT (Wed, 28 Aug 2013) (r85498)
@@ -806,6 +806,7 @@
 // The non-basic rational operations suite
 BOOST_AUTO_TEST_SUITE( rational_extras_suite )
 
+#ifndef BOOST_NO_IOSTREAM
 // Output test
 BOOST_AUTO_TEST_CASE_TEMPLATE( rational_output_test, T, all_signed_test_types )
 {
@@ -880,6 +881,7 @@
     BOOST_CHECK( iss >> r );
     BOOST_CHECK_EQUAL( r, rational_type(1, 2) );
 }
+#endif // BOOST_NO_IOSTREAM
 
 // Conversion test
 BOOST_AUTO_TEST_CASE( rational_cast_test )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk