Chris@16: // Boost.Geometry Index Chris@16: // Chris@16: // Pairs intended to be used internally in nodes. Chris@16: // Chris@16: // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. Chris@16: // Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP Chris@16: #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { namespace geometry { namespace index { Chris@16: Chris@16: namespace detail { namespace rtree { Chris@16: Chris@16: template Chris@16: class ptr_pair Chris@16: { Chris@16: public: Chris@16: typedef First first_type; Chris@16: typedef Pointer second_type; Chris@16: ptr_pair(First const& f, Pointer s) : first(f), second(s) {} Chris@16: //ptr_pair(ptr_pair const& p) : first(p.first), second(p.second) {} Chris@16: //ptr_pair & operator=(ptr_pair const& p) { first = p.first; second = p.second; return *this; } Chris@16: Chris@16: first_type first; Chris@16: second_type second; Chris@16: }; Chris@16: Chris@16: template inline Chris@16: ptr_pair Chris@16: make_ptr_pair(First const& f, Pointer s) Chris@16: { Chris@16: return ptr_pair(f, s); Chris@16: } Chris@16: Chris@16: // TODO: It this will be used, rename it to unique_ptr_pair and possibly use unique_ptr. Chris@16: Chris@16: template Chris@16: class exclusive_ptr_pair Chris@16: { Chris@16: BOOST_MOVABLE_BUT_NOT_COPYABLE(exclusive_ptr_pair) Chris@16: public: Chris@16: typedef First first_type; Chris@16: typedef Pointer second_type; Chris@16: exclusive_ptr_pair(First const& f, Pointer s) : first(f), second(s) {} Chris@16: Chris@16: // INFO - members aren't really moved! Chris@16: exclusive_ptr_pair(BOOST_RV_REF(exclusive_ptr_pair) p) : first(p.first), second(p.second) { p.second = 0; } Chris@16: exclusive_ptr_pair & operator=(BOOST_RV_REF(exclusive_ptr_pair) p) { first = p.first; second = p.second; p.second = 0; return *this; } Chris@16: Chris@16: first_type first; Chris@16: second_type second; Chris@16: }; Chris@16: Chris@16: template inline Chris@16: exclusive_ptr_pair Chris@16: make_exclusive_ptr_pair(First const& f, Pointer s) Chris@16: { Chris@16: return exclusive_ptr_pair(f, s); Chris@16: } Chris@16: Chris@16: }} // namespace detail::rtree Chris@16: Chris@16: }}} // namespace boost::geometry::index Chris@16: Chris@16: #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP