Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62678 - in trunk: boost/tuple libs/tuple/test
From: steven_at_[hidden]
Date: 2010-06-09 13:45:24


Author: steven_watanabe
Date: 2010-06-09 13:45:24 EDT (Wed, 09 Jun 2010)
New Revision: 62678
URL: http://svn.boost.org/trac/boost/changeset/62678

Log:
Make reading a tuple work with std::noskipws. Fixes #1920
Text files modified:
   trunk/boost/tuple/tuple_io.hpp | 4 ++++
   trunk/libs/tuple/test/io_test.cpp | 7 +++++++
   2 files changed, 11 insertions(+), 0 deletions(-)

Modified: trunk/boost/tuple/tuple_io.hpp
==============================================================================
--- trunk/boost/tuple/tuple_io.hpp (original)
+++ trunk/boost/tuple/tuple_io.hpp 2010-06-09 13:45:24 EDT (Wed, 09 Jun 2010)
@@ -384,6 +384,8 @@
     if (is.good() && c!=d) {
       is.setstate(std::ios::failbit);
     }
+ } else {
+ is >> std::ws;
   }
   return is;
 }
@@ -478,6 +480,8 @@
     if (is.good() && c!=d) {
       is.setstate(std::ios::failbit);
     }
+ } else {
+ is >> std::ws;
   }
   return is;
 }

Modified: trunk/libs/tuple/test/io_test.cpp
==============================================================================
--- trunk/libs/tuple/test/io_test.cpp (original)
+++ trunk/libs/tuple/test/io_test.cpp 2010-06-09 13:45:24 EDT (Wed, 09 Jun 2010)
@@ -120,6 +120,13 @@
   is3 >> set_close(']');
   BOOST_CHECK(bool(is3 >> ti2));
 
+ // Make sure that whitespace between elements
+ // is skipped.
+ useThisIStringStream is4("(100 200 300)");
+
+ BOOST_CHECK(bool(is4 >> std::noskipws >> ti1));
+ BOOST_CHECK(ti1 == make_tuple(100, 200, 300));
+
   // Note that strings are problematic:
   // writing a tuple on a stream and reading it back doesn't work in
   // general. If this is wanted, some kind of a parseable string class


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