50# ifndef TPL_DYNBINHEAP_H
51# define TPL_DYNBINHEAP_H
74 template <
class T,
class Compare = Aleph::less<T>>
183 return insert(std::forward<T>(item));
195 T return_value = std::move(node->get_key());
221 Node * node = Node::key_to_node(data);
279 template <
class Operation>
283 {
return op(p->get_key()); });
286 template <
class Operation>
292 template <
class Operation>
296 {
return op(p->get_key()); });
299 template <
class Operation>
314 return KEY(Base::Iterator::get_curr_ne());
Variadic constructor macros for containers.
#define Args_Ctor(Name, Type)
C++20 concepts hub: comparison, BST policy, and Aleph container concepts.
Container traversal and functional operation mixins.
DRY (Don't Repeat Yourself) utilities and macros.
#define Special_Ctors(Set_Type, Type)
Generates special constructors for containers.
static BinHeapNode * key_to_node(Key &__key) noexcept
Dynamic heap of elements of type T ordered by a comparison functor.
T & top() const
Return a reference to the smallest element.
T get()
Alias for getMin().
DynBinHeap(const DynBinHeap &h)
bool traverse(Operation &&op=Operation())
bool erase(T &data) noexcept
Alias for remove().
DynBinHeap(Compare &cmp) noexcept
bool traverse(Operation &&op=Operation()) const
void clear() noexcept
Removes all elements from the heap.
bool traverse(Operation &op) const
T getMin()
Remove the minimum element (according to Compare) and return it.
void copy(const DynBinHeap &src)
void update(T &data) noexcept
Adjust the position of an element after mutating its priority.
void empty() noexcept
Remove every element.
bool remove(T &data) noexcept
Remove an arbitrary element belonging to the heap.
T & put(const T &item)
Synonym of insert().
T & __insert(Node *p) noexcept
typename BinHeap< T, Compare >::Node Node
DynBinHeap(DynBinHeap &&h)
BinHeap< T, Compare > Base
bool traverse(Operation &op)
DynBinHeap & operator=(const DynBinHeap &h)
T & insert(const T &item)
Insert a copy of item into the heap.
DynBinHeap(Compare &&cmp=Compare()) noexcept
T & append(const T &item)
bool preorder_traverse(Node *p, Operation op) const
void update(Node *p) noexcept
Updates the priority of a node contained in the heap.
bool is_empty() const noexcept
Node * getMin()
Removes the node with the lowest priority from the heap.
Node * remove(Node *node)
Removes node from the heap.
void remove_all_and_delete() noexcept
Deletes all the nodes of the heap, invokes the destructors of the removed nodes, and frees all the me...
void for_each_in_preorder(Operation &operation) const
Node * insert(Node *p) noexcept
Inserts a node into a heap.
Node * top()
Returns the node with the lowest priority according to the comparison criterion specified in the decl...
Equality test for containers.
Common methods to the Aleph-w ( ) containers.
Common sequential searching methods on containers.
Mixin that adds STL begin()/end() and cbegin()/cend() to Aleph containers.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
T & swap(T &t1, T &t2)
Generic swap using object's swap method.
std::decay_t< typename HeadC::Item_Type > T
Node heap without virtual destructor.
const T & get_curr_ne() const noexcept
const T & get_curr() const
Iterator() noexcept=default
Default constructor creates an "end" iterator.
Generic list of items stored in a container.
Binary heap implementation using tree structure.
Utility functions for binary tree operations.