istream_range.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright Neil Groves 2010. Use, modification and
  2. // distribution is subject to the Boost Software License, Version
  3. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. //
  6. //
  7. // For more information, see http://www.boost.org/libs/range/
  8. //
  9. #ifndef BOOST_RANGE_ISTREAM_RANGE_HPP_INCLUDED
  10. #define BOOST_RANGE_ISTREAM_RANGE_HPP_INCLUDED
  11. /*!
  12. * \file istream_range.hpp
  13. */
  14. #include <iterator>
  15. #include <iosfwd>
  16. #include <boost/config.hpp>
  17. #include <boost/range/iterator_range.hpp>
  18. namespace boost
  19. {
  20. namespace range
  21. {
  22. template<class Type, class Elem, class Traits> inline
  23. iterator_range<std::istream_iterator<Type, Elem, Traits> >
  24. istream_range(std::basic_istream<Elem, Traits>& in)
  25. {
  26. return iterator_range<std::istream_iterator<Type, Elem, Traits> >(
  27. std::istream_iterator<Type, Elem, Traits>(in),
  28. std::istream_iterator<Type, Elem, Traits>());
  29. }
  30. } // namespace range
  31. using range::istream_range;
  32. } // namespace boost
  33. #endif // include guard