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