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)
7 // For more information, see http://www.boost.org/libs/range/
9 #ifndef BOOST_RANGE_COUNTING_RANGE_HPP_INCLUDED
10 #define BOOST_RANGE_COUNTING_RANGE_HPP_INCLUDED
12 #include <boost/config.hpp>
13 #if BOOST_MSVC >= 1400
15 #pragma warning(disable : 4244)
18 #include <boost/range/iterator_range_core.hpp>
19 #include <boost/range/value_type.hpp>
20 #include <boost/range/iterator.hpp>
21 #include <boost/iterator/counting_iterator.hpp>
26 inline iterator_range<counting_iterator<Value> >
27 counting_range(Value first, Value last)
29 typedef counting_iterator<Value> counting_iterator_t;
30 typedef iterator_range<counting_iterator_t> result_t;
31 return result_t(counting_iterator_t(first),
32 counting_iterator_t(last));
36 inline iterator_range<
38 BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type
41 counting_range(const Range& rng)
43 typedef counting_iterator<
44 BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type
45 > counting_iterator_t;
47 typedef iterator_range<counting_iterator_t> result_t;
49 return result_t(counting_iterator_t(boost::begin(rng)),
50 counting_iterator_t(boost::end(rng)));
54 inline iterator_range<
56 BOOST_DEDUCED_TYPENAME range_iterator<Range>::type
59 counting_range(Range& rng)
61 typedef counting_iterator<
62 BOOST_DEDUCED_TYPENAME range_iterator<Range>::type
63 > counting_iterator_t;
65 typedef iterator_range<counting_iterator_t> result_t;
67 return result_t(counting_iterator_t(boost::begin(rng)),
68 counting_iterator_t(boost::end(rng)));
72 #if BOOST_MSVC >= 1400
76 #endif // include guard