Ticket #13427: reproducer.cpp

File reproducer.cpp, 550 bytes (added by adtac, 5 years ago)

Reproducer

Line 
1#include <boost/heap/binomial_heap.hpp>
2
3struct compare {
4 bool operator()(const int n1, const int n2) const {
5 return n1 > n2;
6 }
7};
8
9int main() {
10 boost::heap::binomial_heap<int, boost::heap::compare<compare>> h;
11 boost::heap::binomial_heap<int, boost::heap::compare<compare>>::handle_type ref;
12
13 int vals[] = {1, 4, 3, 2, 1, 3};
14 for (int i = 0; i < sizeof(vals)/sizeof(int); i++)
15 ref = h.push(vals[i]);
16
17 h.decrease(ref, -1);
18
19 while (!h.empty()) {
20 printf("%d\n", h.top());
21 h.pop();
22 }
23}