File indexing completed on 2025-01-30 09:59:20
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_RANGE_COUNTING_RANGE_HPP_INCLUDED
0010 #define BOOST_RANGE_COUNTING_RANGE_HPP_INCLUDED
0011
0012 #include <boost/config.hpp>
0013 #if BOOST_MSVC >= 1400
0014 #pragma warning(push)
0015 #pragma warning(disable : 4244)
0016 #endif
0017
0018 #include <boost/range/iterator_range_core.hpp>
0019 #include <boost/range/value_type.hpp>
0020 #include <boost/range/iterator.hpp>
0021 #include <boost/iterator/counting_iterator.hpp>
0022
0023 namespace boost
0024 {
0025 template<class Value>
0026 inline iterator_range<counting_iterator<Value> >
0027 counting_range(Value first, Value last)
0028 {
0029 typedef counting_iterator<Value> counting_iterator_t;
0030 typedef iterator_range<counting_iterator_t> result_t;
0031 return result_t(counting_iterator_t(first),
0032 counting_iterator_t(last));
0033 }
0034
0035 template<class Range>
0036 inline iterator_range<
0037 counting_iterator<
0038 BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type
0039 >
0040 >
0041 counting_range(const Range& rng)
0042 {
0043 typedef counting_iterator<
0044 BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type
0045 > counting_iterator_t;
0046
0047 typedef iterator_range<counting_iterator_t> result_t;
0048
0049 return result_t(counting_iterator_t(boost::begin(rng)),
0050 counting_iterator_t(boost::end(rng)));
0051 }
0052
0053 template<class Range>
0054 inline iterator_range<
0055 counting_iterator<
0056 BOOST_DEDUCED_TYPENAME range_iterator<Range>::type
0057 >
0058 >
0059 counting_range(Range& rng)
0060 {
0061 typedef counting_iterator<
0062 BOOST_DEDUCED_TYPENAME range_iterator<Range>::type
0063 > counting_iterator_t;
0064
0065 typedef iterator_range<counting_iterator_t> result_t;
0066
0067 return result_t(counting_iterator_t(boost::begin(rng)),
0068 counting_iterator_t(boost::end(rng)));
0069 }
0070 }
0071
0072 #if BOOST_MSVC >= 1400
0073 #pragma warning(pop)
0074 #endif
0075
0076 #endif