]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/core/mutable_range.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / core / mutable_range.hpp
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_CORE_MUTABLE_RANGE_HPP
19 #define BOOST_GEOMETRY_CORE_MUTABLE_RANGE_HPP
20
21
22 #include <cstddef>
23 #include <type_traits>
24
25 #include <boost/range/value_type.hpp>
26
27
28 namespace boost { namespace geometry
29 {
30
31
32 namespace traits
33 {
34
35 /*!
36 \brief Metafunction to define the argument passed to the three
37 traits classes clear, push_back and resize
38 \ingroup mutable_range
39 */
40 template <typename Range>
41 struct rvalue_type
42 {
43 typedef typename std::remove_reference<Range>::type& type;
44 };
45
46
47 /*!
48 \brief Traits class to clear a geometry
49 \ingroup mutable_range
50 */
51 template <typename Range>
52 struct clear
53 {
54 static inline void apply(typename rvalue_type<Range>::type range)
55 {
56 range.clear();
57 }
58 };
59
60
61 /*!
62 \brief Traits class to append a point to a range (ring, linestring, multi*)
63 \ingroup mutable_range
64 */
65 template <typename Range>
66 struct push_back
67 {
68 typedef typename boost::range_value
69 <
70 typename std::remove_reference<Range>::type
71 >::type item_type;
72
73 static inline void apply(typename rvalue_type<Range>::type range,
74 item_type const& item)
75 {
76 range.push_back(item);
77 }
78 };
79
80
81 /*!
82 \brief Traits class to append a point to a range (ring, linestring, multi*)
83 \ingroup mutable_range
84 */
85 template <typename Range>
86 struct resize
87 {
88 static inline void apply(typename rvalue_type<Range>::type range,
89 std::size_t new_size)
90 {
91 range.resize(new_size);
92 }
93 };
94
95
96 } // namespace traits
97
98
99 }} // namespace boost::geometry
100
101
102 #endif // BOOST_GEOMETRY_CORE_MUTABLE_RANGE_HPP