forked from boostorg/range
[range] Fixed a bug in istream_range() that prevented it from working with character types other than 'char' (refs #7407).
[SVN r84707]
This commit is contained in:
@ -27,8 +27,8 @@ namespace boost
|
|||||||
istream_range(std::basic_istream<Elem, Traits>& in)
|
istream_range(std::basic_istream<Elem, Traits>& in)
|
||||||
{
|
{
|
||||||
return iterator_range<std::istream_iterator<Type, Elem, Traits> >(
|
return iterator_range<std::istream_iterator<Type, Elem, Traits> >(
|
||||||
std::istream_iterator<Type>(in),
|
std::istream_iterator<Type, Elem, Traits>(in),
|
||||||
std::istream_iterator<Type>());
|
std::istream_iterator<Type, Elem, Traits>());
|
||||||
}
|
}
|
||||||
} // namespace range
|
} // namespace range
|
||||||
using range::istream_range;
|
using range::istream_range;
|
||||||
|
@ -19,15 +19,15 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Test an integer range with a step size of 1.
|
template <typename CharT>
|
||||||
void test_istream_range()
|
void test_istream_range_impl()
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::basic_stringstream<CharT> s;
|
||||||
std::vector<int> reference;
|
std::vector<int> reference;
|
||||||
for (int i = 0; i < 10; ++i)
|
for (int i = 0; i < 10; ++i)
|
||||||
{
|
{
|
||||||
reference.push_back(i);
|
reference.push_back(i);
|
||||||
s << i << " ";
|
s << i << CharT(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> target;
|
std::vector<int> target;
|
||||||
@ -36,6 +36,13 @@ namespace
|
|||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.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
|
} // namespace anonymous namespace
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user