1 // Boost.Geometry Index
3 // Pairs intended to be used internally in nodes.
5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
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)
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP
14 #include <boost/move/move.hpp>
16 namespace boost { namespace geometry { namespace index {
18 namespace detail { namespace rtree {
20 template <typename First, typename Pointer>
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; }
34 template <typename First, typename Pointer> inline
35 ptr_pair<First, Pointer>
36 make_ptr_pair(First const& f, Pointer s)
38 return ptr_pair<First, Pointer>(f, s);
41 // TODO: It this will be used, rename it to unique_ptr_pair and possibly use unique_ptr.
43 template <typename First, typename Pointer>
44 class exclusive_ptr_pair
46 BOOST_MOVABLE_BUT_NOT_COPYABLE(exclusive_ptr_pair)
48 typedef First first_type;
49 typedef Pointer second_type;
50 exclusive_ptr_pair(First const& f, Pointer s) : first(f), second(s) {}
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; }
60 template <typename First, typename Pointer> inline
61 exclusive_ptr_pair<First, Pointer>
62 make_exclusive_ptr_pair(First const& f, Pointer s)
64 return exclusive_ptr_pair<First, Pointer>(f, s);
67 }} // namespace detail::rtree
69 }}} // namespace boost::geometry::index
71 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP