|
#pragma once
#include <cstddef>
#include <iostream>
#include <iterator> // for istream_iterator
#include <boost/range/iterator_range.hpp>
namespace poost {
template<
class T,
class CharT,
class TraitsT = std::char_traits<CharT>,
class DistanceT = std::ptrdiff_t
>
struct istream_range :
boost::iterator_range< std::istream_iterator< T, CharT, TraitsT, DistanceT > >
{
private:
typedef std::istream_iterator<T, CharT, TraitsT, DistanceT> iterator_t;
typedef boost::iterator_range<iterator_t> super_t;
public:
explicit istream_range(std::basic_istream<CharT, TraitsT>& s) :
super_t(iterator_t(s), iterator_t())
{ }
};
template< class T, class CharT >
inline
istream_range< T, CharT >
make_istream_range(std::basic_istream< CharT, std::char_traits<CharT> >& s)
{
return istream_range< T, CharT, std::char_traits<CharT>, std::ptrdiff_t >(s);
}
} // namespace poost
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.