File indexing completed on 2025-01-18 09:35:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_ITERATORS_POINT_REVERSE_ITERATOR_HPP
0011 #define BOOST_GEOMETRY_ITERATORS_POINT_REVERSE_ITERATOR_HPP
0012
0013 #include <iterator>
0014 #include <type_traits>
0015
0016 #include <boost/geometry/iterators/point_iterator.hpp>
0017
0018 namespace boost { namespace geometry
0019 {
0020
0021
0022
0023 template <typename Geometry>
0024 class point_reverse_iterator
0025 : public std::reverse_iterator<point_iterator<Geometry> >
0026 {
0027 private:
0028 typedef std::reverse_iterator<point_iterator<Geometry> > base_type;
0029
0030 template <typename OtherGeometry> friend class point_reverse_iterator;
0031 template <typename G>
0032 friend inline point_reverse_iterator<G> points_rbegin(G&);
0033
0034 template <typename G>
0035 friend inline point_reverse_iterator<G> points_rend(G&);
0036
0037 inline point_reverse_iterator(base_type const& base_it)
0038 : base_type(base_it) {}
0039
0040 public:
0041 inline point_reverse_iterator() = default;
0042
0043 template
0044 <
0045 typename OtherGeometry,
0046 std::enable_if_t
0047 <
0048 std::is_convertible
0049 <
0050 std::reverse_iterator<point_iterator<OtherGeometry> >,
0051 std::reverse_iterator<point_iterator<Geometry> >
0052 >::value,
0053 int
0054 > = 0
0055 >
0056 inline point_reverse_iterator(point_reverse_iterator<OtherGeometry> const& other)
0057 : base_type(other.base())
0058 {}
0059 };
0060
0061
0062
0063 template <typename Geometry>
0064 inline point_reverse_iterator<Geometry>
0065 points_rbegin(Geometry& geometry)
0066 {
0067 return std::reverse_iterator
0068 <
0069 point_iterator<Geometry>
0070 >(points_end(geometry));
0071 }
0072
0073
0074
0075 template <typename Geometry>
0076 inline point_reverse_iterator<Geometry>
0077 points_rend(Geometry& geometry)
0078 {
0079 return std::reverse_iterator
0080 <
0081 point_iterator<Geometry>
0082 >(points_begin(geometry));
0083 }
0084
0085
0086 }}
0087
0088 #endif