Example #1
0
void fill_heap(pri_queue & q, int index, int size, int offset = 0)
{
    test_data const & data = get_data(index);

    for (int i = 0; i != size + 1; ++i) {
        q.push(data[i]);
        int top = q.top();
        q.pop();
        q.push(top);
    }
}
Example #2
0
void check_q(pri_queue & q, data_container const & expected)
{
    BOOST_REQUIRE_EQUAL(q.size(), expected.size());

    for (unsigned int i = 0; i != expected.size(); ++i)
    {
        BOOST_REQUIRE_EQUAL(q.size(), expected.size() - i);
        BOOST_REQUIRE_EQUAL(q.top(), expected[expected.size()-1-i]);
        q.pop();
    }

    BOOST_REQUIRE(q.empty());
}
Example #3
0
void fill_heap_with_handles(pri_queue & q, handle_container & handles, int index, int size, int offset = 0)
{
    test_data const & data = get_data(index);

    for (int i = 0; i != size + 1; ++i) {
        handles[i] = q.push(data[i]);

        if (i > 0) {
            typename pri_queue::handle_type last = handles[i-1];
            int val = *last;
            q.erase(last);
            handles[i-1] = q.push(val);
        }
    }
}
Example #4
0
void fill_emplace_q(pri_queue & q, data_container const & data)
{
    for (unsigned int i = 0; i != data.size(); ++i) {
        typename pri_queue::value_type value = data[i];
        q.emplace(std::move(value));
    }
}
Example #5
0
void fill_q(pri_queue & q, data_container const & data)
{
    for (unsigned int i = 0; i != data.size(); ++i)
        q.push(data[i]);
}