Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / range / istream_range.hpp
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 /*!
13  * \file istream_range.hpp
14  */
15
16 #include <iterator>
17 #include <iosfwd>
18 #include <boost/config.hpp>
19 #include <boost/range/iterator_range.hpp>
20
21 namespace boost
22 {
23     namespace range
24     {
25         template<class Type, class Elem, class Traits> inline
26             iterator_range<std::istream_iterator<Type, Elem, Traits> >
27         istream_range(std::basic_istream<Elem, Traits>& in)
28         {
29             return iterator_range<std::istream_iterator<Type, Elem, Traits> >(
30                 std::istream_iterator<Type, Elem, Traits>(in),
31                 std::istream_iterator<Type, Elem, Traits>());
32         }
33     } // namespace range
34     using range::istream_range;
35 } // namespace boost
36
37 #endif // include guard