cpp-common/bt2c: add `bt2c::PrioHeap` (C++ version of `bt_heap_` C API)
This new class template is a templated C++ version of
`src/lib/prio-heap/prio-heap.*` (C API), written by Mathieu Desnoyers,
which implements an efficient heap data structure.
In true C++ spirit, it accepts and stores a comparator (which may be an
object; `std::greatest` instance by default) instead of a simple
function pointer, making it possible for the user to store some context.
This version copies instances of `T` during its operations, so it's best
to use with small objects such as pointers, integers, and small PODs.
A benefit over `std::priority_queue`, which offers a similar interface,
is the replaceTop() method which performs a single heap rebalance when
you need to remove the top (greatest) element and immediately insert one
(possibly the same one).
`src/lib/prio-heap/prio-heap.*` are removed because they're not used
anywhere in the project and we only plan to write new C++ code anyway in
the future.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I830ab79ef067c0ebb2fc33466b3dc831c617a049
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11419
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
This page took 0.044123 seconds and 4 git commands to generate.