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_IDENTITY_VIEW_HPP
|
Chris@16
|
15 #define BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/range.hpp>
|
Chris@16
|
19
|
Chris@16
|
20
|
Chris@16
|
21 namespace boost { namespace geometry
|
Chris@16
|
22 {
|
Chris@16
|
23
|
Chris@16
|
24 // Silence warning C4512: assignment operator could not be generated
|
Chris@16
|
25 #if defined(_MSC_VER)
|
Chris@101
|
26 #pragma warning(push)
|
Chris@16
|
27 #pragma warning(disable : 4512)
|
Chris@16
|
28 #endif
|
Chris@16
|
29
|
Chris@16
|
30 /*!
|
Chris@16
|
31 \brief View on a range, not modifying anything
|
Chris@16
|
32 \tparam Range original range
|
Chris@16
|
33 \ingroup views
|
Chris@16
|
34 */
|
Chris@16
|
35 template <typename Range>
|
Chris@16
|
36 struct identity_view
|
Chris@16
|
37 {
|
Chris@16
|
38 typedef typename boost::range_iterator<Range const>::type const_iterator;
|
Chris@16
|
39 typedef typename boost::range_iterator<Range>::type iterator;
|
Chris@16
|
40
|
Chris@16
|
41 explicit inline identity_view(Range& r)
|
Chris@16
|
42 : m_range(r)
|
Chris@16
|
43 {}
|
Chris@16
|
44
|
Chris@16
|
45 inline const_iterator begin() const { return boost::begin(m_range); }
|
Chris@16
|
46 inline const_iterator end() const { return boost::end(m_range); }
|
Chris@16
|
47
|
Chris@16
|
48 inline iterator begin() { return boost::begin(m_range); }
|
Chris@16
|
49 inline iterator end() { return boost::end(m_range); }
|
Chris@16
|
50 private :
|
Chris@16
|
51 Range& m_range;
|
Chris@16
|
52 };
|
Chris@16
|
53
|
Chris@16
|
54 #if defined(_MSC_VER)
|
Chris@16
|
55 #pragma warning(pop)
|
Chris@16
|
56 #endif
|
Chris@16
|
57
|
Chris@16
|
58 }} // namespace boost::geometry
|
Chris@16
|
59
|
Chris@16
|
60
|
Chris@16
|
61 #endif // BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP
|