]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/index/detail/rtree/node/pairs.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / index / detail / rtree / node / pairs.hpp
1 // Boost.Geometry Index
2 //
3 // Pairs intended to be used internally in nodes.
4 //
5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
6 //
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP
13
14 #include <boost/move/move.hpp>
15
16 namespace boost { namespace geometry { namespace index {
17
18 namespace detail { namespace rtree {
19
20 template <typename First, typename Pointer>
21 class ptr_pair
22 {
23 public:
24 typedef First first_type;
25 typedef Pointer second_type;
26 ptr_pair(First const& f, Pointer s) : first(f), second(s) {}
27 //ptr_pair(ptr_pair const& p) : first(p.first), second(p.second) {}
28 //ptr_pair & operator=(ptr_pair const& p) { first = p.first; second = p.second; return *this; }
29
30 first_type first;
31 second_type second;
32 };
33
34 template <typename First, typename Pointer> inline
35 ptr_pair<First, Pointer>
36 make_ptr_pair(First const& f, Pointer s)
37 {
38 return ptr_pair<First, Pointer>(f, s);
39 }
40
41 // TODO: It this will be used, rename it to unique_ptr_pair and possibly use unique_ptr.
42
43 template <typename First, typename Pointer>
44 class exclusive_ptr_pair
45 {
46 BOOST_MOVABLE_BUT_NOT_COPYABLE(exclusive_ptr_pair)
47 public:
48 typedef First first_type;
49 typedef Pointer second_type;
50 exclusive_ptr_pair(First const& f, Pointer s) : first(f), second(s) {}
51
52 // INFO - members aren't really moved!
53 exclusive_ptr_pair(BOOST_RV_REF(exclusive_ptr_pair) p) : first(p.first), second(p.second) { p.second = 0; }
54 exclusive_ptr_pair & operator=(BOOST_RV_REF(exclusive_ptr_pair) p) { first = p.first; second = p.second; p.second = 0; return *this; }
55
56 first_type first;
57 second_type second;
58 };
59
60 template <typename First, typename Pointer> inline
61 exclusive_ptr_pair<First, Pointer>
62 make_exclusive_ptr_pair(First const& f, Pointer s)
63 {
64 return exclusive_ptr_pair<First, Pointer>(f, s);
65 }
66
67 }} // namespace detail::rtree
68
69 }}} // namespace boost::geometry::index
70
71 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP