Make reading a tuple work with std::noskipws. Fixes #1920

[SVN r62678]
This commit is contained in:
Steven Watanabe
2010-06-09 17:45:24 +00:00
parent d908a5d566
commit 052b3db77f
2 changed files with 11 additions and 0 deletions

View File

@ -384,6 +384,8 @@ extract_and_check_delimiter(
if (is.good() && c!=d) {
is.setstate(std::ios::failbit);
}
} else {
is >> std::ws;
}
return is;
}
@ -478,6 +480,8 @@ extract_and_check_delimiter(
if (is.good() && c!=d) {
is.setstate(std::ios::failbit);
}
} else {
is >> std::ws;
}
return is;
}

View File

@ -120,6 +120,13 @@ int test_main(int argc, char * argv[] ) {
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