1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP
19 #define BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP
22 #include <boost/version.hpp>
23 #include <boost/range/adaptor/reversed.hpp>
25 #include <boost/geometry/core/ring_type.hpp>
26 #include <boost/geometry/core/tag.hpp>
27 #include <boost/geometry/core/tags.hpp>
29 #include <boost/geometry/views/identity_view.hpp>
31 namespace boost { namespace geometry
35 \brief Flag for iterating a reversible_view in forward or reverse direction
38 enum iterate_direction { iterate_forward, iterate_reverse };
41 \brief View on a range, reversing direction if necessary
42 \tparam Range original range
43 \tparam Direction direction of iteration
46 template <typename Range, iterate_direction Direction>
47 struct reversible_view {};
51 #ifndef DOXYGEN_NO_SPECIALIZATIONS
53 template <typename Range>
54 struct reversible_view<Range, iterate_forward>
56 typedef identity_view<Range> type;
60 template <typename Range>
61 struct reversible_view<Range, iterate_reverse>
63 #if BOOST_VERSION > 104500
64 typedef boost::reversed_range<Range> type;
66 // For older versions of Boost
67 typedef boost::range_detail::reverse_range<Range> type;
71 #endif // DOXYGEN_NO_SPECIALIZATIONS
74 }} // namespace boost::geometry
77 #endif // BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP