pairing_heap.hpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. // boost heap: pairing heap
  2. //
  3. // Copyright (C) 2010 Tim Blechmann
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #ifndef BOOST_HEAP_PAIRING_HEAP_HPP
  9. #define BOOST_HEAP_PAIRING_HEAP_HPP
  10. #include <algorithm>
  11. #include <utility>
  12. #include <vector>
  13. #include <boost/assert.hpp>
  14. #include <boost/heap/detail/heap_comparison.hpp>
  15. #include <boost/heap/detail/heap_node.hpp>
  16. #include <boost/heap/policies.hpp>
  17. #include <boost/heap/detail/stable_heap.hpp>
  18. #include <boost/heap/detail/tree_iterator.hpp>
  19. #ifndef BOOST_DOXYGEN_INVOKED
  20. #ifdef BOOST_HEAP_SANITYCHECKS
  21. #define BOOST_HEAP_ASSERT BOOST_ASSERT
  22. #else
  23. #define BOOST_HEAP_ASSERT(expression)
  24. #endif
  25. #endif
  26. namespace boost {
  27. namespace heap {
  28. namespace detail {
  29. typedef parameter::parameters<boost::parameter::optional<tag::allocator>,
  30. boost::parameter::optional<tag::compare>,
  31. boost::parameter::optional<tag::stable>,
  32. boost::parameter::optional<tag::constant_time_size>,
  33. boost::parameter::optional<tag::stability_counter_type>
  34. > pairing_heap_signature;
  35. template <typename T, typename Parspec>
  36. struct make_pairing_heap_base
  37. {
  38. static const bool constant_time_size = parameter::binding<Parspec,
  39. tag::constant_time_size,
  40. boost::mpl::true_
  41. >::type::value;
  42. typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::type base_type;
  43. typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::allocator_argument allocator_argument;
  44. typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::compare_argument compare_argument;
  45. typedef heap_node<typename base_type::internal_type, false> node_type;
  46. typedef typename allocator_argument::template rebind<node_type>::other allocator_type;
  47. struct type:
  48. base_type,
  49. allocator_type
  50. {
  51. type(compare_argument const & arg):
  52. base_type(arg)
  53. {}
  54. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  55. type(type const & rhs):
  56. base_type(rhs), allocator_type(rhs)
  57. {}
  58. type(type && rhs):
  59. base_type(std::move(static_cast<base_type&>(rhs))),
  60. allocator_type(std::move(static_cast<allocator_type&>(rhs)))
  61. {}
  62. type & operator=(type && rhs)
  63. {
  64. base_type::operator=(std::move(static_cast<base_type&>(rhs)));
  65. allocator_type::operator=(std::move(static_cast<allocator_type&>(rhs)));
  66. return *this;
  67. }
  68. type & operator=(type const & rhs)
  69. {
  70. base_type::operator=(static_cast<base_type const &>(rhs));
  71. allocator_type::operator=(static_cast<const allocator_type&>(rhs));
  72. return *this;
  73. }
  74. #endif
  75. };
  76. };
  77. }
  78. /**
  79. * \class pairing_heap
  80. * \brief pairing heap
  81. *
  82. * Pairing heaps are self-adjusting binary heaps. Although design and implementation are rather simple,
  83. * the complexity analysis is yet unsolved. For details, consult:
  84. *
  85. * Pettie, Seth (2005), "Towards a final analysis of pairing heaps",
  86. * Proc. 46th Annual IEEE Symposium on Foundations of Computer Science, pp. 174-183
  87. *
  88. * The template parameter T is the type to be managed by the container.
  89. * The user can specify additional options and if no options are provided default options are used.
  90. *
  91. * The container supports the following options:
  92. * - \c boost::heap::compare<>, defaults to \c compare<std::less<T> >
  93. * - \c boost::heap::stable<>, defaults to \c stable<false>
  94. * - \c boost::heap::stability_counter_type<>, defaults to \c stability_counter_type<boost::uintmax_t>
  95. * - \c boost::heap::allocator<>, defaults to \c allocator<std::allocator<T> >
  96. * - \c boost::heap::constant_time_size<>, defaults to \c constant_time_size<true>
  97. *
  98. *
  99. */
  100. #ifdef BOOST_DOXYGEN_INVOKED
  101. template<class T, class ...Options>
  102. #else
  103. template <typename T,
  104. class A0 = boost::parameter::void_,
  105. class A1 = boost::parameter::void_,
  106. class A2 = boost::parameter::void_,
  107. class A3 = boost::parameter::void_,
  108. class A4 = boost::parameter::void_
  109. >
  110. #endif
  111. class pairing_heap:
  112. private detail::make_pairing_heap_base<T,
  113. typename detail::pairing_heap_signature::bind<A0, A1, A2, A3, A4>::type
  114. >::type
  115. {
  116. typedef typename detail::pairing_heap_signature::bind<A0, A1, A2, A3, A4>::type bound_args;
  117. typedef detail::make_pairing_heap_base<T, bound_args> base_maker;
  118. typedef typename base_maker::type super_t;
  119. typedef typename super_t::internal_type internal_type;
  120. typedef typename super_t::size_holder_type size_holder;
  121. typedef typename base_maker::allocator_argument allocator_argument;
  122. private:
  123. template <typename Heap1, typename Heap2>
  124. friend struct heap_merge_emulate;
  125. #ifndef BOOST_DOXYGEN_INVOKED
  126. struct implementation_defined:
  127. detail::extract_allocator_types<typename base_maker::allocator_argument>
  128. {
  129. typedef T value_type;
  130. typedef typename detail::extract_allocator_types<typename base_maker::allocator_argument>::size_type size_type;
  131. typedef typename detail::extract_allocator_types<typename base_maker::allocator_argument>::reference reference;
  132. typedef typename base_maker::compare_argument value_compare;
  133. typedef typename base_maker::allocator_type allocator_type;
  134. typedef typename allocator_type::pointer node_pointer;
  135. typedef typename allocator_type::const_pointer const_node_pointer;
  136. typedef detail::heap_node_list node_list_type;
  137. typedef typename node_list_type::iterator node_list_iterator;
  138. typedef typename node_list_type::const_iterator node_list_const_iterator;
  139. typedef typename base_maker::node_type node;
  140. typedef detail::value_extractor<value_type, internal_type, super_t> value_extractor;
  141. typedef typename super_t::internal_compare internal_compare;
  142. typedef detail::node_handle<node_pointer, super_t, reference> handle_type;
  143. typedef detail::tree_iterator<node,
  144. const value_type,
  145. allocator_type,
  146. value_extractor,
  147. detail::pointer_to_reference<node>,
  148. false,
  149. false,
  150. value_compare
  151. > iterator;
  152. typedef iterator const_iterator;
  153. typedef detail::tree_iterator<node,
  154. const value_type,
  155. allocator_type,
  156. value_extractor,
  157. detail::pointer_to_reference<node>,
  158. false,
  159. true,
  160. value_compare
  161. > ordered_iterator;
  162. };
  163. typedef typename implementation_defined::node node;
  164. typedef typename implementation_defined::node_pointer node_pointer;
  165. typedef typename implementation_defined::node_list_type node_list_type;
  166. typedef typename implementation_defined::node_list_iterator node_list_iterator;
  167. typedef typename implementation_defined::node_list_const_iterator node_list_const_iterator;
  168. typedef typename implementation_defined::internal_compare internal_compare;
  169. typedef boost::intrusive::list<detail::heap_node_base<true>,
  170. boost::intrusive::constant_time_size<false>
  171. > node_child_list;
  172. #endif
  173. public:
  174. typedef T value_type;
  175. typedef typename implementation_defined::size_type size_type;
  176. typedef typename implementation_defined::difference_type difference_type;
  177. typedef typename implementation_defined::value_compare value_compare;
  178. typedef typename implementation_defined::allocator_type allocator_type;
  179. typedef typename implementation_defined::reference reference;
  180. typedef typename implementation_defined::const_reference const_reference;
  181. typedef typename implementation_defined::pointer pointer;
  182. typedef typename implementation_defined::const_pointer const_pointer;
  183. /// \copydoc boost::heap::priority_queue::iterator
  184. typedef typename implementation_defined::iterator iterator;
  185. typedef typename implementation_defined::const_iterator const_iterator;
  186. typedef typename implementation_defined::ordered_iterator ordered_iterator;
  187. typedef typename implementation_defined::handle_type handle_type;
  188. static const bool constant_time_size = super_t::constant_time_size;
  189. static const bool has_ordered_iterators = true;
  190. static const bool is_mergable = true;
  191. static const bool is_stable = detail::extract_stable<bound_args>::value;
  192. static const bool has_reserve = false;
  193. /// \copydoc boost::heap::priority_queue::priority_queue(value_compare const &)
  194. explicit pairing_heap(value_compare const & cmp = value_compare()):
  195. super_t(cmp), root(NULL)
  196. {}
  197. /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue const &)
  198. pairing_heap(pairing_heap const & rhs):
  199. super_t(rhs), root(NULL)
  200. {
  201. if (rhs.empty())
  202. return;
  203. clone_tree(rhs);
  204. size_holder::set_size(rhs.get_size());
  205. }
  206. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  207. /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&)
  208. pairing_heap(pairing_heap && rhs):
  209. super_t(std::move(rhs)), root(rhs.root)
  210. {
  211. rhs.root = NULL;
  212. }
  213. /// \copydoc boost::heap::priority_queue::operator=(priority_queue &&)
  214. pairing_heap & operator=(pairing_heap && rhs)
  215. {
  216. super_t::operator=(std::move(rhs));
  217. root = rhs.root;
  218. rhs.root = NULL;
  219. return *this;
  220. }
  221. #endif
  222. /// \copydoc boost::heap::priority_queue::operator=(priority_queue const & rhs)
  223. pairing_heap & operator=(pairing_heap const & rhs)
  224. {
  225. clear();
  226. size_holder::set_size(rhs.get_size());
  227. static_cast<super_t&>(*this) = rhs;
  228. clone_tree(rhs);
  229. return *this;
  230. }
  231. ~pairing_heap(void)
  232. {
  233. while (!empty())
  234. pop();
  235. }
  236. /// \copydoc boost::heap::priority_queue::empty
  237. bool empty(void) const
  238. {
  239. return root == NULL;
  240. }
  241. /// \copydoc boost::heap::binomial_heap::size
  242. size_type size(void) const
  243. {
  244. if (constant_time_size)
  245. return size_holder::get_size();
  246. if (root == NULL)
  247. return 0;
  248. else
  249. return detail::count_nodes(root);
  250. }
  251. /// \copydoc boost::heap::priority_queue::max_size
  252. size_type max_size(void) const
  253. {
  254. return allocator_type::max_size();
  255. }
  256. /// \copydoc boost::heap::priority_queue::clear
  257. void clear(void)
  258. {
  259. if (empty())
  260. return;
  261. root->template clear_subtree<allocator_type>(*this);
  262. root->~node();
  263. allocator_type::deallocate(root, 1);
  264. root = NULL;
  265. size_holder::set_size(0);
  266. }
  267. /// \copydoc boost::heap::priority_queue::get_allocator
  268. allocator_type get_allocator(void) const
  269. {
  270. return *this;
  271. }
  272. /// \copydoc boost::heap::priority_queue::swap
  273. void swap(pairing_heap & rhs)
  274. {
  275. super_t::swap(rhs);
  276. std::swap(root, rhs.root);
  277. }
  278. /// \copydoc boost::heap::priority_queue::top
  279. const_reference top(void) const
  280. {
  281. BOOST_ASSERT(!empty());
  282. return super_t::get_value(root->value);
  283. }
  284. /**
  285. * \b Effects: Adds a new element to the priority queue. Returns handle to element
  286. *
  287. * \cond
  288. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  289. * \endcond
  290. *
  291. * \b Complexity: 2**2*log(log(N)) (amortized).
  292. *
  293. * */
  294. handle_type push(value_type const & v)
  295. {
  296. size_holder::increment();
  297. node_pointer n = allocator_type::allocate(1);
  298. new(n) node(super_t::make_node(v));
  299. merge_node(n);
  300. return handle_type(n);
  301. }
  302. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  303. /**
  304. * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element.
  305. *
  306. * \cond
  307. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  308. * \endcond
  309. *
  310. * \b Complexity: 2**2*log(log(N)) (amortized).
  311. *
  312. * */
  313. template <class... Args>
  314. handle_type emplace(Args&&... args)
  315. {
  316. size_holder::increment();
  317. node_pointer n = allocator_type::allocate(1);
  318. new(n) node(super_t::make_node(std::forward<Args>(args)...));
  319. merge_node(n);
  320. return handle_type(n);
  321. }
  322. #endif
  323. /**
  324. * \b Effects: Removes the top element from the priority queue.
  325. *
  326. * \b Complexity: Logarithmic (amortized).
  327. *
  328. * */
  329. void pop(void)
  330. {
  331. BOOST_ASSERT(!empty());
  332. erase(handle_type(root));
  333. }
  334. /**
  335. * \b Effects: Assigns \c v to the element handled by \c handle & updates the priority queue.
  336. *
  337. * \cond
  338. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  339. * \endcond
  340. *
  341. * \b Complexity: 2**2*log(log(N)) (amortized).
  342. *
  343. * */
  344. void update (handle_type handle, const_reference v)
  345. {
  346. handle.node_->value = super_t::make_node(v);
  347. update(handle);
  348. }
  349. /**
  350. * \b Effects: Updates the heap after the element handled by \c handle has been changed.
  351. *
  352. * \cond
  353. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  354. * \endcond
  355. *
  356. * \b Complexity: 2**2*log(log(N)) (amortized).
  357. *
  358. * \b Note: If this is not called, after a handle has been updated, the behavior of the data structure is undefined!
  359. * */
  360. void update (handle_type handle)
  361. {
  362. node_pointer n = handle.node_;
  363. n->unlink();
  364. if (!n->children.empty())
  365. n = merge_nodes(n, merge_node_list(n->children));
  366. if (n != root)
  367. merge_node(n);
  368. }
  369. /**
  370. * \b Effects: Assigns \c v to the element handled by \c handle & updates the priority queue.
  371. *
  372. * \cond
  373. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  374. * \endcond
  375. *
  376. * \b Complexity: 2**2*log(log(N)) (amortized).
  377. *
  378. * \b Note: The new value is expected to be greater than the current one
  379. * */
  380. void increase (handle_type handle, const_reference v)
  381. {
  382. update(handle, v);
  383. }
  384. /**
  385. * \b Effects: Updates the heap after the element handled by \c handle has been changed.
  386. *
  387. * \cond
  388. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  389. * \endcond
  390. *
  391. * \b Complexity: 2**2*log(log(N)) (amortized).
  392. *
  393. * \b Note: If this is not called, after a handle has been updated, the behavior of the data structure is undefined!
  394. * */
  395. void increase (handle_type handle)
  396. {
  397. update(handle);
  398. }
  399. /**
  400. * \b Effects: Assigns \c v to the element handled by \c handle & updates the priority queue.
  401. *
  402. * \cond
  403. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  404. * \endcond
  405. *
  406. * \b Complexity: 2**2*log(log(N)) (amortized).
  407. *
  408. * \b Note: The new value is expected to be less than the current one
  409. * */
  410. void decrease (handle_type handle, const_reference v)
  411. {
  412. update(handle, v);
  413. }
  414. /**
  415. * \b Effects: Updates the heap after the element handled by \c handle has been changed.
  416. *
  417. * \cond
  418. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  419. * \endcond
  420. *
  421. * \b Complexity: 2**2*log(log(N)) (amortized).
  422. *
  423. * \b Note: The new value is expected to be less than the current one. If this is not called, after a handle has been updated, the behavior of the data structure is undefined!
  424. * */
  425. void decrease (handle_type handle)
  426. {
  427. update(handle);
  428. }
  429. /**
  430. * \b Effects: Removes the element handled by \c handle from the priority_queue.
  431. *
  432. * \cond
  433. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  434. * \endcond
  435. *
  436. * \b Complexity: 2**2*log(log(N)) (amortized).
  437. * */
  438. void erase(handle_type handle)
  439. {
  440. node_pointer n = handle.node_;
  441. if (n != root) {
  442. n->unlink();
  443. if (!n->children.empty())
  444. merge_node(merge_node_list(n->children));
  445. } else {
  446. if (!n->children.empty())
  447. root = merge_node_list(n->children);
  448. else
  449. root = NULL;
  450. }
  451. size_holder::decrement();
  452. n->~node();
  453. allocator_type::deallocate(n, 1);
  454. }
  455. /// \copydoc boost::heap::priority_queue::begin
  456. iterator begin(void) const
  457. {
  458. return iterator(root, super_t::value_comp());
  459. }
  460. /// \copydoc boost::heap::priority_queue::end
  461. iterator end(void) const
  462. {
  463. return iterator();
  464. }
  465. /// \copydoc boost::heap::fibonacci_heap::ordered_begin
  466. ordered_iterator ordered_begin(void) const
  467. {
  468. return ordered_iterator(root, super_t::value_comp());
  469. }
  470. /// \copydoc boost::heap::fibonacci_heap::ordered_begin
  471. ordered_iterator ordered_end(void) const
  472. {
  473. return ordered_iterator(NULL, super_t::value_comp());
  474. }
  475. /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator
  476. static handle_type s_handle_from_iterator(iterator const & it)
  477. {
  478. node * ptr = const_cast<node *>(it.get_node());
  479. return handle_type(ptr);
  480. }
  481. /**
  482. * \b Effects: Merge all elements from rhs into this
  483. *
  484. * \cond
  485. * \b Complexity: \f$2^2log(log(N))\f$ (amortized).
  486. * \endcond
  487. *
  488. * \b Complexity: 2**2*log(log(N)) (amortized).
  489. *
  490. * */
  491. void merge(pairing_heap & rhs)
  492. {
  493. if (rhs.empty())
  494. return;
  495. merge_node(rhs.root);
  496. size_holder::add(rhs.get_size());
  497. rhs.set_size(0);
  498. rhs.root = NULL;
  499. super_t::set_stability_count((std::max)(super_t::get_stability_count(),
  500. rhs.get_stability_count()));
  501. rhs.set_stability_count(0);
  502. }
  503. /// \copydoc boost::heap::priority_queue::value_comp
  504. value_compare const & value_comp(void) const
  505. {
  506. return super_t::value_comp();
  507. }
  508. /// \copydoc boost::heap::priority_queue::operator<(HeapType const & rhs) const
  509. template <typename HeapType>
  510. bool operator<(HeapType const & rhs) const
  511. {
  512. return detail::heap_compare(*this, rhs);
  513. }
  514. /// \copydoc boost::heap::priority_queue::operator>(HeapType const & rhs) const
  515. template <typename HeapType>
  516. bool operator>(HeapType const & rhs) const
  517. {
  518. return detail::heap_compare(rhs, *this);
  519. }
  520. /// \copydoc boost::heap::priority_queue::operator>=(HeapType const & rhs) const
  521. template <typename HeapType>
  522. bool operator>=(HeapType const & rhs) const
  523. {
  524. return !operator<(rhs);
  525. }
  526. /// \copydoc boost::heap::priority_queue::operator<=(HeapType const & rhs) const
  527. template <typename HeapType>
  528. bool operator<=(HeapType const & rhs) const
  529. {
  530. return !operator>(rhs);
  531. }
  532. /// \copydoc boost::heap::priority_queue::operator==(HeapType const & rhs) const
  533. template <typename HeapType>
  534. bool operator==(HeapType const & rhs) const
  535. {
  536. return detail::heap_equality(*this, rhs);
  537. }
  538. /// \copydoc boost::heap::priority_queue::operator!=(HeapType const & rhs) const
  539. template <typename HeapType>
  540. bool operator!=(HeapType const & rhs) const
  541. {
  542. return !(*this == rhs);
  543. }
  544. private:
  545. #if !defined(BOOST_DOXYGEN_INVOKED)
  546. void clone_tree(pairing_heap const & rhs)
  547. {
  548. BOOST_HEAP_ASSERT(root == NULL);
  549. if (rhs.empty())
  550. return;
  551. root = allocator_type::allocate(1);
  552. new(root) node(static_cast<node const &>(*rhs.root), static_cast<allocator_type&>(*this));
  553. }
  554. void merge_node(node_pointer other)
  555. {
  556. BOOST_HEAP_ASSERT(other);
  557. if (root != NULL)
  558. root = merge_nodes(root, other);
  559. else
  560. root = other;
  561. }
  562. node_pointer merge_node_list(node_child_list & children)
  563. {
  564. BOOST_HEAP_ASSERT(!children.empty());
  565. node_pointer merged = merge_first_pair(children);
  566. if (children.empty())
  567. return merged;
  568. node_child_list node_list;
  569. node_list.push_back(*merged);
  570. do {
  571. node_pointer next_merged = merge_first_pair(children);
  572. node_list.push_back(*next_merged);
  573. } while (!children.empty());
  574. return merge_node_list(node_list);
  575. }
  576. node_pointer merge_first_pair(node_child_list & children)
  577. {
  578. BOOST_HEAP_ASSERT(!children.empty());
  579. node_pointer first_child = static_cast<node_pointer>(&children.front());
  580. children.pop_front();
  581. if (children.empty())
  582. return first_child;
  583. node_pointer second_child = static_cast<node_pointer>(&children.front());
  584. children.pop_front();
  585. return merge_nodes(first_child, second_child);
  586. }
  587. node_pointer merge_nodes(node_pointer node1, node_pointer node2)
  588. {
  589. if (super_t::operator()(node1->value, node2->value))
  590. std::swap(node1, node2);
  591. node2->unlink();
  592. node1->children.push_front(*node2);
  593. return node1;
  594. }
  595. node_pointer root;
  596. #endif
  597. };
  598. } /* namespace heap */
  599. } /* namespace boost */
  600. #undef BOOST_HEAP_ASSERT
  601. #endif /* BOOST_HEAP_PAIRING_HEAP_HPP */