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)
|
||||
{
|
||||
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;
|
||||
|
@ -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;
|
||||
@ -37,6 +37,13 @@ namespace
|
||||
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::unit_test::test_suite*
|
||||
|
Reference in New Issue
Block a user