Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84707 - in trunk: boost/range libs/range/test
From: zeratul976_at_[hidden]
Date: 2013-06-08 22:34:37


Author: nathanridge
Date: 2013-06-08 22:34:36 EDT (Sat, 08 Jun 2013)
New Revision: 84707
URL: http://svn.boost.org/trac/boost/changeset/84707

Log:
[range] Fixed a bug in istream_range() that prevented it from working with character types other than 'char' (refs #7407).

Text files modified:
   trunk/boost/range/istream_range.hpp | 4 ++--
   trunk/libs/range/test/istream_range.cpp | 15 +++++++++++----
   2 files changed, 13 insertions(+), 6 deletions(-)

Modified: trunk/boost/range/istream_range.hpp
==============================================================================
--- trunk/boost/range/istream_range.hpp Sat Jun 8 18:55:23 2013 (r84706)
+++ trunk/boost/range/istream_range.hpp 2013-06-08 22:34:36 EDT (Sat, 08 Jun 2013) (r84707)
@@ -27,8 +27,8 @@
         istream_range(std::basic_istream<Elem, Traits>& in)
         {
             return iterator_range<std::istream_iterator<Type, Elem, Traits> >(
- std::istream_iterator<Type>(in),
- std::istream_iterator<Type>());
+ std::istream_iterator<Type, Elem, Traits>(in),
+ std::istream_iterator<Type, Elem, Traits>());
         }
     } // namespace range
     using range::istream_range;

Modified: trunk/libs/range/test/istream_range.cpp
==============================================================================
--- trunk/libs/range/test/istream_range.cpp Sat Jun 8 18:55:23 2013 (r84706)
+++ trunk/libs/range/test/istream_range.cpp 2013-06-08 22:34:36 EDT (Sat, 08 Jun 2013) (r84707)
@@ -19,15 +19,15 @@
 
 namespace
 {
- // Test an integer range with a step size of 1.
- void test_istream_range()
+ template <typename CharT>
+ void test_istream_range_impl()
     {
- std::stringstream s;
+ std::basic_stringstream<CharT> s;
         std::vector<int> reference;
         for (int i = 0; i < 10; ++i)
         {
             reference.push_back(i);
- s << i << " ";
+ s << i << CharT(' ');
         }
 
         std::vector<int> target;
@@ -36,6 +36,13 @@
         BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
             target.begin(), target.end() );
     }
+
+ // Test an istream range.
+ void test_istream_range()
+ {
+ test_istream_range_impl<char>();
+ test_istream_range_impl<wchar_t>();
+ }
 
 } // namespace anonymous namespace
 


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