Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@16
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@16
|
6
|
Chris@16
|
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@16
|
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@16
|
9
|
Chris@16
|
10 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
13
|
Chris@16
|
14 #ifndef BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP
|
Chris@16
|
15 #define BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/version.hpp>
|
Chris@16
|
19 #include <boost/range.hpp>
|
Chris@16
|
20 #include <boost/range/adaptor/reversed.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 #include <boost/geometry/core/ring_type.hpp>
|
Chris@16
|
23 #include <boost/geometry/core/tag.hpp>
|
Chris@16
|
24 #include <boost/geometry/core/tags.hpp>
|
Chris@16
|
25
|
Chris@16
|
26 #include <boost/geometry/views/identity_view.hpp>
|
Chris@16
|
27
|
Chris@16
|
28 namespace boost { namespace geometry
|
Chris@16
|
29 {
|
Chris@16
|
30
|
Chris@16
|
31 /*!
|
Chris@16
|
32 \brief Flag for iterating a reversible_view in forward or reverse direction
|
Chris@16
|
33 \ingroup views
|
Chris@16
|
34 */
|
Chris@16
|
35 enum iterate_direction { iterate_forward, iterate_reverse };
|
Chris@16
|
36
|
Chris@16
|
37 /*!
|
Chris@16
|
38 \brief View on a range, reversing direction if necessary
|
Chris@16
|
39 \tparam Range original range
|
Chris@16
|
40 \tparam Direction direction of iteration
|
Chris@16
|
41 \ingroup views
|
Chris@16
|
42 */
|
Chris@16
|
43 template <typename Range, iterate_direction Direction>
|
Chris@16
|
44 struct reversible_view {};
|
Chris@16
|
45
|
Chris@16
|
46
|
Chris@16
|
47
|
Chris@16
|
48 #ifndef DOXYGEN_NO_SPECIALIZATIONS
|
Chris@16
|
49
|
Chris@16
|
50 template <typename Range>
|
Chris@16
|
51 struct reversible_view<Range, iterate_forward>
|
Chris@16
|
52 {
|
Chris@16
|
53 typedef identity_view<Range> type;
|
Chris@16
|
54 };
|
Chris@16
|
55
|
Chris@16
|
56
|
Chris@16
|
57 template <typename Range>
|
Chris@16
|
58 struct reversible_view<Range, iterate_reverse>
|
Chris@16
|
59 {
|
Chris@16
|
60 #if BOOST_VERSION > 104500
|
Chris@16
|
61 typedef boost::reversed_range<Range> type;
|
Chris@16
|
62 #else
|
Chris@16
|
63 // For older versions of Boost
|
Chris@16
|
64 typedef boost::range_detail::reverse_range<Range> type;
|
Chris@16
|
65 #endif
|
Chris@16
|
66 };
|
Chris@16
|
67
|
Chris@16
|
68 #endif // DOXYGEN_NO_SPECIALIZATIONS
|
Chris@16
|
69
|
Chris@16
|
70
|
Chris@16
|
71 }} // namespace boost::geometry
|
Chris@16
|
72
|
Chris@16
|
73
|
Chris@16
|
74 #endif // BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP
|