[Boost-bugs] [Boost C++ Libraries] #12679: Merging heaps causes them to "forget" pending lazy updates.

Subject: [Boost-bugs] [Boost C++ Libraries] #12679: Merging heaps causes them to "forget" pending lazy updates.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-12-12 07:11:49


#12679: Merging heaps causes them to "forget" pending lazy updates.
-------------------------------+--------------------------
 Reporter: shirpeled+boost@… | Owner: timblechmann
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: heap
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: heap, lazy, merge |
-------------------------------+--------------------------
 In my opinion, a reasonable behavior for the code below would be to print
 out:
 99, 2, 1,
 In reality, though, the output is:
 2, 99, 1,

 This means that the lazy_update() is somehow forgotten in the process of
 merging the two heaps.


 {{{
   boost::heap::fibonacci_heap<float> q1, q2;
   std::vector<boost::heap::fibonacci_heap<float>::handle_type> handles;
   handles.push_back(q1.push(0.f));
   handles.push_back(q1.push(1.f));
   handles.push_back(q2.push(2.f));
   q1.update_lazy(handles[0], 99.f);
   q1.merge(q2);
   while (!q1.empty()) {
     std::cout << q1.top() << ", ";
     q1.pop();
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12679>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC