]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/iterators/point_reverse_iterator.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / iterators / point_reverse_iterator.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
20effc67 3// Copyright (c) 2014-2020, Oracle and/or its affiliates.
7c673cae 4// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
20effc67 5// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7c673cae
FG
6
7// Licensed under the Boost Software License version 1.0.
8// http://www.boost.org/users/license.html
9
10#ifndef BOOST_GEOMETRY_ITERATORS_POINT_REVERSE_ITERATOR_HPP
11#define BOOST_GEOMETRY_ITERATORS_POINT_REVERSE_ITERATOR_HPP
12
13#include <iterator>
20effc67 14#include <type_traits>
7c673cae 15
20effc67 16#include <boost/geometry/core/static_assert.hpp>
7c673cae
FG
17#include <boost/geometry/iterators/point_iterator.hpp>
18
19namespace boost { namespace geometry
20{
21
22
23// MK:: need to add doc here
24template <typename Geometry>
25class point_reverse_iterator
26 : public std::reverse_iterator<point_iterator<Geometry> >
27{
28private:
29 typedef std::reverse_iterator<point_iterator<Geometry> > base_type;
30
31 template <typename OtherGeometry> friend class point_reverse_iterator;
32 template <typename G>
33 friend inline point_reverse_iterator<G> points_rbegin(G&);
34
35 template <typename G>
36 friend inline point_reverse_iterator<G> points_rend(G&);
37
38 inline point_reverse_iterator(base_type const& base_it)
39 : base_type(base_it) {}
40
41public:
42 inline point_reverse_iterator() {}
43
44 template <typename OtherGeometry>
45 inline
46 point_reverse_iterator(point_reverse_iterator<OtherGeometry> const& other)
47 : base_type(other.base())
48 {
20effc67 49 static const bool is_conv = std::is_convertible
7c673cae
FG
50 <
51 std::reverse_iterator<point_iterator<Geometry> >,
52 std::reverse_iterator<point_iterator<OtherGeometry> >
53 >::value;
54
20effc67
TL
55 BOOST_GEOMETRY_STATIC_ASSERT((is_conv),
56 "Other iterator has to be convertible to member iterator.",
57 point_reverse_iterator<OtherGeometry>);
7c673cae
FG
58 }
59};
60
61
62// MK:: need to add doc here
63template <typename Geometry>
64inline point_reverse_iterator<Geometry>
65points_rbegin(Geometry& geometry)
66{
67 return std::reverse_iterator
68 <
69 point_iterator<Geometry>
70 >(points_end(geometry));
71}
72
73
74// MK:: need to add doc here
75template <typename Geometry>
76inline point_reverse_iterator<Geometry>
77points_rend(Geometry& geometry)
78{
79 return std::reverse_iterator
80 <
81 point_iterator<Geometry>
82 >(points_begin(geometry));
83}
84
85
86}} // namespace boost::geometry
87
88#endif // BOOST_GEOMETRY_ITERATORS_POINT_REVERSE_ITERATOR_HPP