7 #ifndef INCLUDE_KDTREE_ALLOCATOR_HPP 8 #define INCLUDE_KDTREE_ALLOCATOR_HPP 17 template <
typename _Tp,
typename _Alloc>
23 typedef _Alloc allocator_type;
26 : _M_node_allocator(__A) {}
31 return _M_node_allocator;
43 _Node_ *
get() {
return new_node; }
44 void disconnect() { new_node = NULL; }
46 ~
NoLeakAlloc() {
if (new_node) base->_M_deallocate_node(new_node); }
51 allocator_type _M_node_allocator;
56 return _M_node_allocator.allocate(1);
60 _M_deallocate_node(_Node_*
const __P)
62 return _M_node_allocator.deallocate(__P, 1);
66 _M_construct_node(_Node_* __p, _Tp
const __V = _Tp(),
67 _Base_ptr
const __PARENT = NULL,
68 _Base_ptr
const __LEFT = NULL,
69 _Base_ptr
const __RIGHT = NULL)
71 new (__p) _Node_(__V, __PARENT, __LEFT, __RIGHT);
75 _M_destroy_node(_Node_* __p)
77 _M_node_allocator.destroy(__p);
83 #endif // include guard
Definition: allocator.hpp:18
Defines interfaces for nodes as used by the KDTree class.
Definition: allocator.hpp:14
Definition: allocator.hpp:35