source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/range/counting_range.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 2.2 KB
Line 
1// Boost.Range library
2//
3// Copyright Neil Groves 2008. Use, modification and
4// distribution is subject to the Boost Software Licence, Version
5// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8// For more information, see http://www.boost.org/libs/range
9//
10
11#ifndef BOOST_RANGE_COUNTING_RANGE_HPP_INCLUDED
12#define BOOST_RANGE_COUNTING_RANGE_HPP_INCLUDED
13
14#include <boost/config.hpp>
15#if BOOST_MSVC >= 1400
16#pragma warning(push)
17#pragma warning(disable : 4244)
18#endif
19
20#include <boost/range/iterator_range_core.hpp>
21#include <boost/range/value_type.hpp>
22#include <boost/iterator/counting_iterator.hpp>
23#include <boost/utility.hpp>
24
25namespace boost
26{
27
28    template<class Value>
29    inline iterator_range<counting_iterator<Value> >
30    counting_range(Value first, Value last)
31    {
32        typedef counting_iterator<Value> counting_iterator_t;
33        typedef iterator_range<counting_iterator_t> result_t;
34        return result_t(counting_iterator_t(first),
35                        counting_iterator_t(last));
36    }
37
38    template<class Range>
39    inline iterator_range<counting_iterator<BOOST_DEDUCED_TYPENAME range_value<const Range>::type> >
40    counting_range(const Range& rng)
41    {
42        typedef counting_iterator<BOOST_DEDUCED_TYPENAME range_value<const Range>::type> counting_iterator_t;
43        typedef iterator_range<counting_iterator_t> result_t;
44        return boost::empty(rng)
45            ? result_t()
46            : result_t(
47                counting_iterator_t(*boost::begin(rng)),
48                counting_iterator_t(*boost::prior(boost::end(rng))));
49    }
50
51    template<class Range>
52    inline iterator_range<counting_iterator<BOOST_DEDUCED_TYPENAME range_value<Range>::type> >
53    counting_range(Range& rng)
54    {
55        typedef counting_iterator<BOOST_DEDUCED_TYPENAME range_value<Range>::type> counting_iterator_t;
56        typedef iterator_range<counting_iterator_t> result_t;
57        return boost::empty(rng)
58            ? result_t()
59            : result_t(
60                counting_iterator_t(*boost::begin(rng)),
61                counting_iterator_t(*boost::prior(boost::end(rng))));
62    }
63} // namespace boost
64
65#if BOOST_MSVC >= 1400
66#pragma warning(pop)
67#endif
68
69#endif // include guard
Note: See TracBrowser for help on using the repository browser.