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 // 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
10 
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13 
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)
17 
18 #ifndef BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
19 #define BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
20 
21 
22 #include <boost/range/begin.hpp>
23 #include <boost/range/end.hpp>
24 
25 
26 namespace boost { namespace geometry
27 {
28 
29 // Silence warning C4512: assignment operator could not be generated
30 #if defined(_MSC_VER)
31 #pragma warning(push)
32 #pragma warning(disable : 4512)
33 #endif
34 
35 /*!
36 \brief View on a range, not modifying anything
37 \tparam Range original range
38 \ingroup views
39 */
40 template <typename Range>
41 struct identity_view
42 {
43     typedef typename boost::range_iterator<Range const>::type const_iterator;
44     typedef typename boost::range_iterator<Range>::type iterator;
45 
identity_viewboost::geometry::identity_view46     explicit inline identity_view(Range& r)
47         : m_range(r)
48     {}
49 
beginboost::geometry::identity_view50     inline const_iterator begin() const { return boost::begin(m_range); }
endboost::geometry::identity_view51     inline const_iterator end() const { return boost::end(m_range); }
52 
beginboost::geometry::identity_view53     inline iterator begin() { return boost::begin(m_range); }
endboost::geometry::identity_view54     inline iterator end() { return boost::end(m_range); }
55 private :
56     Range& m_range;
57 };
58 
59 #if defined(_MSC_VER)
60 #pragma warning(pop)
61 #endif
62 
63 }} // namespace boost::geometry
64 
65 
66 #endif // BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
67