
Hi All I'd really appreciate an example of the use of istream_range from the Boost.Range library. I tried this #include <iostream> #include <iterator> #include "boost/range.hpp" #include "boost/range/istream_range.hpp" #include "boost/range/algorithm.hpp" void f( int i ) { std :: cout << i << std :: endl; } int main( ) { typedef std :: istream_iterator< int > in; boost :: for_each( boost :: istream_range< in >( std :: cin ), f ); return 0; } and other variations, but I don't think any of them are right! Do I really have to specify three template type parameters? The signature of the template is namespace boost { template<class Type, class Elem, class Traits> inline range<std::istream_iterator<Type, Elem, Traits> > istream_range(std::basic_istream<Elem, Traits>& in) { return range<std::istream_iterator<Type, Elem, Traits> >( std::istream_iterator<Elem>(in), std::istream_iterator<Elem>()); } } Thanks, Rob.