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