|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Fixed-capacity binary heap backed by a raw array. More...
#include <tpl_arrayHeap.H>
Classes | |
| struct | Iterator |
Public Types | |
| using | Item_Type = T |
| using | Key_Type = T |
Public Types inherited from StlAlephIterator< SetName > | |
| using | iterator = StlIterator< SetName > |
| using | const_iterator = StlConstIterator< SetName > |
Public Member Functions | |
| void | allocate_storage (const size_t new_dim) |
| Allocate internal storage and reset the heap. | |
| void | swap (ArrayHeap &h) noexcept |
| Swap all state with another heap. | |
| template<template< typename > class List> | |
| ArrayHeap (const List< T > &l) | |
| template<class It > | |
| ArrayHeap (It b, It e) | |
| ArrayHeap (std::initializer_list< T > l) | |
| ArrayHeap (const size_t d=1024, Compare cmp_fct=Compare()) | |
| Construct an empty heap with internal storage. | |
| ArrayHeap (T *ptr, const size_t &d, Compare cmp_fct=Compare()) | |
| Construct an empty heap using an external buffer. | |
| ArrayHeap (const ArrayHeap &h) | |
| ArrayHeap (ArrayHeap &&h) noexcept | |
| ArrayHeap & | operator= (const ArrayHeap &h) |
| ArrayHeap & | operator= (ArrayHeap &&h) noexcept |
| virtual | ~ArrayHeap () |
| Destructor. | |
| T & | top () |
| Return a mutable reference to the minimum element. | |
| const T & | top () const |
| Return a const reference to the minimum element. | |
| T & | insert_ne (const T &key) |
| Insert an element without checking capacity. | |
| T & | insert_ne (T &&key) |
| Insert an element without checking capacity (move overload). | |
| T & | insert (const T &key) |
| Insert an element into the heap. | |
| T & | insert (T &&key) |
| Insert an element into the heap (move overload). | |
| T & | put (const T &key) |
| Synonym for insert(). | |
| T & | append (const T &key) |
| Synonym for insert(). | |
| T & | put (T &&key) |
| Synonym for insert() (move overload). | |
| T & | append (T &&key) |
| Synonym for insert() (move overload). | |
| T | getMin () |
| Remove the smallest element in the heap and return a copy of its value. | |
| T | get () |
| T | getMax () |
| constexpr size_t | size () const noexcept |
| Return the number of elements currently stored. | |
| constexpr bool | is_empty () const noexcept |
| Return true if the heap is empty. | |
| constexpr size_t | capacity () const noexcept |
| Return the maximum number of elements that can be stored. | |
| void | update (T &data) |
| Update the priority of an element stored in the heap. | |
| void | remove (T &item) |
| Remove an element from the heap given a reference to it. | |
| T & | operator[] (const size_t i) |
| Return a mutable reference to the i-th entry (1-based). | |
| const T & | operator[] (const size_t i) const |
| Const overload of operator[] (1-based). | |
| template<class Operation > | |
| bool | traverse (Operation &operation) const |
| Traverse all elements (const overload). | |
| template<class Operation > | |
| bool | traverse (Operation &operation) |
| Traverse all elements. | |
| template<class Operation > | |
| bool | traverse (Operation &&operation=Operation()) const |
| Traverse all elements (const forwarding overload). | |
| template<class Operation > | |
| bool | traverse (Operation &&operation=Operation()) |
| Traverse all elements (forwarding overload). | |
Public Member Functions inherited from LocateFunctions< Container, Type > | |
| auto | get_it () const |
| Return a properly initialized iterator positioned at the first item on the container. | |
| auto | get_it (const size_t pos) const |
Return a properly initialized iterator positioned at the pos item on the container. | |
| auto | get_itor () const |
Alias of get_it(). | |
| Type & | nth_ne (const size_t n) noexcept |
| Return the n‑th element without bounds checking. | |
| const Type & | nth_ne (const size_t n) const noexcept |
Const overload of nth_ne(size_t). | |
| Type & | nth (const size_t n) |
| Return the n-th item of container. | |
| const Type & | nth (const size_t n) const |
Const overload of nth(size_t). | |
| template<class Operation > | |
| Type * | find_ptr (Operation &operation) noexcept(operation_is_noexcept< Operation >()) |
| Find a pointer to an item in the container according to a searching criteria. | |
| template<class Operation > | |
| const Type * | find_ptr (Operation &operation) const noexcept(operation_is_noexcept< Operation >()) |
Const overload of find_ptr(Operation&). | |
| template<class Operation > | |
| const Type * | find_ptr (Operation &&operation) const noexcept(operation_is_noexcept< Operation >()) |
Overload of find_ptr(Operation&) const that accepts rvalues. | |
| template<class Operation > | |
| Type * | find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >()) |
Overload of find_ptr(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| size_t | find_index (Operation &operation) const noexcept(operation_is_noexcept< Operation >()) |
| Find the position of an item in the container according to a searching criteria. | |
| template<class Operation > | |
| size_t | find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >()) |
Overload of find_index(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| std::tuple< bool, Type > | find_item (Operation &operation) noexcept(operation_is_noexcept< Operation >()) |
| Safe sequential searching of an item matching a criteria. | |
| template<class Operation > | |
| std::tuple< bool, Type > | find_item (Operation &operation) const noexcept(operation_is_noexcept< Operation >()) |
| template<class Operation > | |
| std::tuple< bool, Type > | find_item (Operation &&operation) noexcept(operation_is_noexcept< Operation >()) |
| template<class Operation > | |
| std::tuple< bool, Type > | find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >()) |
Public Member Functions inherited from FunctionalMethods< Container, T > | |
| template<typename ... Args> | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it in-place with the given args. | |
| template<typename ... Args> | |
| void | emplace_end (Args &&... args) |
| template<typename ... Args> | |
| void | emplace_ins (Args &&... args) |
| Insert a new element into the container by constructing it in-place with the given args. | |
| template<typename ... Args> | |
| size_t | ninsert (Args ... args) |
| Insert n variadic items. | |
| template<typename ... Args> | |
| size_t | nappend (Args ... args) |
| Append n variadic items. | |
| template<class Operation > | |
| void | for_each (Operation &operation) |
| Traverse all the container and performs an operation on each element. | |
| template<class Operation > | |
| void | for_each (Operation &operation) const |
Const overload of for_each(Operation&). | |
| template<class Operation > | |
| void | for_each (Operation &&operation) const |
Overload of for_each(Operation&) const that accepts rvalues. | |
| template<class Operation > | |
| void | for_each (Operation &&operation) |
Overload of for_each(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| void | each (Operation &operation) |
Alias of for_each(Operation&). | |
| template<class Operation > | |
| void | each (Operation &operation) const |
Const alias of for_each(Operation&). | |
| template<class Operation > | |
| void | each (Operation &&operation) const |
Const alias of for_each(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| void | each (Operation &&operation) |
Alias of for_each(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| void | each (size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element. | |
| template<class Operation > | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
| template<class Operation > | |
| void | mutable_for_each (Operation &operation) |
| template<class Operation > | |
| void | mutable_for_each (Operation &&operation) |
| template<class Operation > | |
| bool | all (Operation &operation) const |
| Check if all the elements of container satisfy a condition. | |
| template<class Operation > | |
| bool | all (Operation &&operation) const |
Overload of all(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criteria. | |
| template<class Operation > | |
| bool | exists (Operation &&op) const |
Overload of exists(Operation&) that accepts rvalues. | |
| template<typename __T = T, class Operation = Aleph::Dft_Map_Op<T, __T>> | |
| Aleph::DynList< __T > | maps (Operation &op) const |
| Map the elements of the container. | |
| template<typename __T = T, class Operation = Aleph::Dft_Map_Op<__T, __T>> | |
| Aleph::DynList< __T > | maps (Operation &&op) const |
Overload of maps(Operation&) that accepts rvalues. | |
| template<typename __T = T, class Prop , class Operation > | |
| Aleph::DynList< __T > | maps_if (Prop prop, Operation &op) const |
| Conditional mapping of the elements of the container. | |
| template<typename __T = T, class Prop , class Operation > | |
| Aleph::DynList< __T > | maps_if (Prop prop, Operation &&op) const |
Overload of maps_if(Prop, Operation&) that accepts rvalues. | |
| Aleph::DynList< T > | to_dynlist () const |
| Convert container to DynList. | |
| std::vector< T > | to_vector () const |
| Convert container to std::vector. | |
| template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>> | |
| __T | foldl (const __T &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>> | |
| __T | foldl (const __T &init, Op &&op=Op()) const |
Overload of foldl(const __T&, Op&) that accepts rvalues. | |
| template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>> | |
| __T | fold_left (const __T &init, Op &op) const |
| Alias for foldl with the same accumulator type. | |
| template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>> | |
| __T | fold_left (const __T &init, Op &&op=Op()) const |
Overload of fold_left(const __T&, Op&) that accepts rvalues. | |
| template<class Operation > | |
| T | fold (const T &init, Operation &operation) const |
| Simplified version of foldl() where the folded type is the same type of elements stored in the container. | |
| template<class Operation > | |
| T | fold (const T &init, Operation &&operation) const |
Overload of fold(const T&, Operation&) that accepts rvalues. | |
| template<class Operation > | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criteria. | |
| template<class Operation > | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
Overload of filter(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criteria and return a pointer to the matched items in the container. | |
| template<class Operation > | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
Overload of ptr_filter(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container. | |
| template<class Operation > | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
Overload of pfilter(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criteria. | |
| template<class Operation > | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
Overload of partition(Operation&) that accepts rvalues. | |
| template<class Operation > | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (size_t n) const |
| Exclusive partition of container in the nth item. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | split_half () const |
| Split the container into two halves by alternating elements. | |
| template<class Operation > | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &op) const |
| Exclusive partition of container according to a filter criteria. | |
| template<class Operation > | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
Overload of tpartition(Operation&) that accepts rvalues. | |
| size_t | length () const noexcept |
| Count the number of elements of a container. | |
| Aleph::DynList< T > | rev () const |
| Return a list with the elements of container in reverse order respect to its traversal order. | |
| Aleph::DynList< T > | take (const size_t n) const |
| Return a list with the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take (size_t i, const size_t j, const size_t step=1) const |
| Return a list with elements seen in the container between i and j position respect to its traversal. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| void | mutable_drop (const size_t n) |
| Drop the first n elements seen from container. | |
Public Member Functions inherited from GenericItems< Container, T > | |
| Aleph::DynList< T > | items () const |
| Return a list of all the elements of a container sorted by traversal order. | |
| Aleph::DynList< T > | keys () const |
Public Member Functions inherited from EqualToMethod< Container > | |
| bool | equal_to (const Container &r) const noexcept |
Test if elements of this are exactly contained in another container. | |
| bool | operator== (const Container &r) const noexcept |
| bool | operator!= (const Container &r) const noexcept |
| Negation of equal_to() | |
Public Member Functions inherited from StlAlephIterator< SetName > | |
| iterator | begin () noexcept |
| Return an STL-compatible iterator to the first element. | |
| iterator | end () noexcept |
| Return an STL-compatible end iterator. | |
| const_iterator | begin () const noexcept |
| Return a const iterator to the first element. | |
| const_iterator | end () const noexcept |
| Return a const end iterator. | |
| const_iterator | cbegin () const noexcept |
| Return a const iterator to the first element. | |
| const_iterator | cend () const noexcept |
| Return a const end iterator. | |
Private Member Functions | |
| template<class Operation > | |
| bool | traverse_impl (Operation &operation) |
Static Private Member Functions | |
| static size_t | r_index (const size_t &i) |
Private Attributes | |
| T * | array = nullptr |
| size_t | dim = 0 |
| size_t | num_items = 0 |
| bool | array_allocated = false |
| Compare | cmp |
Additional Inherited Members | |
Related Symbols inherited from FunctionalMethods< Container, T > | |
| each | |
| each | |
| each | |
Fixed-capacity binary heap backed by a raw array.
The heap stores elements from index 1 to num_items and keeps index 0 as sentinel, which simplifies the parent/child arithmetic.
| T | element type |
| Compare | comparator defining the priority order |
Definition at line 264 of file tpl_arrayHeap.H.
| using Aleph::ArrayHeap< T, Compare >::Item_Type = T |
Definition at line 316 of file tpl_arrayHeap.H.
| using Aleph::ArrayHeap< T, Compare >::Key_Type = T |
Definition at line 318 of file tpl_arrayHeap.H.
|
inline |
Definition at line 320 of file tpl_arrayHeap.H.
|
inline |
Definition at line 320 of file tpl_arrayHeap.H.
|
inline |
Definition at line 320 of file tpl_arrayHeap.H.
|
inline |
Construct an empty heap with internal storage.
| [in] | d | capacity (number of usable heap slots) |
| [in] | cmp_fct | comparator |
| invalid_argument | if d == 0 |
Definition at line 328 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::allocate_storage().
|
inline |
Construct an empty heap using an external buffer.
The heap will not manage the lifetime of ptr.
| [in] | ptr | external buffer (must have at least d + 1 elements) |
| [in] | d | capacity (number of usable heap slots) |
| [in] | cmp_fct | comparator |
| invalid_argument | if ptr == nullptr or d == 0 |
Definition at line 343 of file tpl_arrayHeap.H.
References ah_invalid_argument_if, and FunctionalMethods< Container, T >::maps().
|
inline |
Definition at line 349 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::allocate_storage(), Aleph::ArrayHeap< T, Compare >::array, h, and Aleph::ArrayHeap< T, Compare >::num_items.
|
inlinenoexcept |
Definition at line 358 of file tpl_arrayHeap.H.
References h, and Aleph::ArrayHeap< T, Compare >::swap().
|
inlinevirtual |
Destructor.
Definition at line 388 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::array_allocated, and FunctionalMethods< Container, T >::maps().
|
inline |
Allocate internal storage and reset the heap.
| [in] | new_dim | new capacity (number of usable heap slots) |
| invalid_argument | if new_dim == 0 |
Definition at line 289 of file tpl_arrayHeap.H.
References ah_invalid_argument_if, Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::array_allocated, Aleph::ArrayHeap< T, Compare >::dim, FunctionalMethods< Container, T >::maps(), and Aleph::ArrayHeap< T, Compare >::num_items.
Referenced by Aleph::ArrayHeap< T, Compare >::ArrayHeap(), Aleph::ArrayHeap< T, Compare >::ArrayHeap(), and Aleph::ArrayHeap< T, Compare >::operator=().
|
inline |
Synonym for insert().
| [in] | key | value to insert |
Definition at line 483 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::insert().
|
inline |
Synonym for insert() (move overload).
| [in] | key | value to insert |
Definition at line 499 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::insert().
|
inlineconstexprnoexcept |
Return the maximum number of elements that can be stored.
This excludes the sentinel slot at index 0.
Definition at line 542 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::dim.
|
inline |
Definition at line 521 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::getMin().
Referenced by TEST().
|
inline |
Definition at line 527 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::getMin().
Referenced by TEST().
|
inline |
Remove the smallest element in the heap and return a copy of its value.
getMin() extracts the element with the lowest value according to the configured comparator.
| underflow_error | if the heap is empty. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 509 of file tpl_arrayHeap.H.
References ah_underflow_error_if, Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::cmp, FunctionalMethods< Container, T >::maps(), Aleph::ArrayHeap< T, Compare >::num_items, and Aleph::sift_down().
Referenced by Aleph::ArrayHeap< T, Compare >::get(), Aleph::ArrayHeap< T, Compare >::getMax(), TEST(), and TEST().
|
inline |
Insert an element into the heap.
insert(key) stores a copy of key inside the heap.
| [in] | key | value to insert. |
| overflow_error | if the internal array is full. |
Definition at line 450 of file tpl_arrayHeap.H.
References ah_overflow_error_if, Aleph::ArrayHeap< T, Compare >::dim, Aleph::ArrayHeap< T, Compare >::insert_ne(), and Aleph::ArrayHeap< T, Compare >::num_items.
Referenced by Aleph::ArrayHeap< T, Compare >::append(), Aleph::ArrayHeap< T, Compare >::append(), main(), Aleph::ArrayHeap< T, Compare >::put(), Aleph::ArrayHeap< T, Compare >::put(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Insert an element into the heap (move overload).
| [in] | key | value to insert |
| overflow_error | if the internal array is full |
Definition at line 463 of file tpl_arrayHeap.H.
References ah_overflow_error_if, Aleph::ArrayHeap< T, Compare >::dim, Aleph::ArrayHeap< T, Compare >::insert_ne(), and Aleph::ArrayHeap< T, Compare >::num_items.
|
inline |
Insert an element without checking capacity.
| [in] | key | value to insert |
Definition at line 423 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::cmp, Aleph::ArrayHeap< T, Compare >::num_items, and Aleph::sift_up().
Referenced by Aleph::ArrayHeap< T, Compare >::insert(), and Aleph::ArrayHeap< T, Compare >::insert().
|
inline |
Insert an element without checking capacity (move overload).
| [in] | key | value to insert |
Definition at line 436 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::cmp, Aleph::ArrayHeap< T, Compare >::num_items, and Aleph::sift_up().
|
inlineconstexprnoexcept |
Return true if the heap is empty.
Definition at line 536 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::num_items.
|
inlinenoexcept |
Definition at line 380 of file tpl_arrayHeap.H.
References h, and Aleph::ArrayHeap< T, Compare >::swap().
|
inline |
Definition at line 364 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::allocate_storage(), Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::cmp, Aleph::ArrayHeap< T, Compare >::dim, h, and Aleph::ArrayHeap< T, Compare >::num_items.
|
inline |
Return a mutable reference to the i-th entry (1-based).
No bounds checking is performed.
| [in] | i | index |
i Definition at line 599 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array.
|
inline |
Const overload of operator[] (1-based).
| [in] | i | index |
i Definition at line 609 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array.
|
inline |
Synonym for insert().
| [in] | key | value to insert |
Definition at line 475 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::insert().
|
inline |
Synonym for insert() (move overload).
| [in] | key | value to insert |
Definition at line 491 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::insert().
Definition at line 278 of file tpl_arrayHeap.H.
|
inline |
Remove an element from the heap given a reference to it.
The reference must refer to an element stored in this heap.
| [in,out] | item | reference to the element to remove |
| underflow_error | if the heap is empty |
item is a valid reference into this heap. Definition at line 575 of file tpl_arrayHeap.H.
References ah_underflow_error_if, Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::cmp, FunctionalMethods< Container, T >::maps(), Aleph::ArrayHeap< T, Compare >::num_items, and Aleph::sift_down_up().
Referenced by TEST().
|
inlineconstexprnoexcept |
Return the number of elements currently stored.
Definition at line 533 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::num_items.
Referenced by exists_in_heap(), main(), TEST(), and TEST().
|
inlinenoexcept |
Swap all state with another heap.
| [in,out] | h | other heap |
Definition at line 307 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::array_allocated, Aleph::ArrayHeap< T, Compare >::cmp, Aleph::ArrayHeap< T, Compare >::dim, h, and Aleph::ArrayHeap< T, Compare >::num_items.
Referenced by Aleph::ArrayHeap< T, Compare >::ArrayHeap(), and Aleph::ArrayHeap< T, Compare >::operator=().
|
inline |
Return a mutable reference to the minimum element.
| underflow_error | if the heap is empty |
Definition at line 398 of file tpl_arrayHeap.H.
References ah_underflow_error_if, Aleph::ArrayHeap< T, Compare >::array, and Aleph::ArrayHeap< T, Compare >::num_items.
|
inline |
Return a const reference to the minimum element.
| underflow_error | if the heap is empty |
Definition at line 409 of file tpl_arrayHeap.H.
References ah_underflow_error_if, Aleph::ArrayHeap< T, Compare >::array, and Aleph::ArrayHeap< T, Compare >::num_items.
|
inline |
Traverse all elements (forwarding overload).
| Operation | callable type |
| [in] | operation | functor to apply |
Definition at line 681 of file tpl_arrayHeap.H.
References FunctionalMethods< Container, T >::maps(), and Aleph::ArrayHeap< T, Compare >::traverse_impl().
|
inline |
Traverse all elements (const forwarding overload).
| Operation | callable type |
| [in] | operation | functor to apply |
Definition at line 669 of file tpl_arrayHeap.H.
References FunctionalMethods< Container, T >::maps(), and Aleph::ArrayHeap< T, Compare >::traverse_impl().
|
inline |
Traverse all elements.
| Operation | callable type |
| [in,out] | operation | functor to apply |
Definition at line 657 of file tpl_arrayHeap.H.
References FunctionalMethods< Container, T >::maps(), and Aleph::ArrayHeap< T, Compare >::traverse_impl().
|
inline |
Traverse all elements (const overload).
Iterates over indices [1, size()] and applies operation to each element until it returns false.
| Operation | callable type |
| [in,out] | operation | functor to apply |
Definition at line 645 of file tpl_arrayHeap.H.
References FunctionalMethods< Container, T >::maps(), and Aleph::ArrayHeap< T, Compare >::traverse_impl().
|
inlineprivate |
Definition at line 625 of file tpl_arrayHeap.H.
References Aleph::ArrayHeap< T, Compare >::array, FunctionalMethods< Container, T >::maps(), and Aleph::ArrayHeap< T, Compare >::num_items.
Referenced by Aleph::ArrayHeap< T, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse(), and Aleph::ArrayHeap< T, Compare >::traverse().
|
inline |
Update the priority of an element stored in the heap.
update(data) takes a reference to an element inside the heap, presumably modified, and updates its priority inside the heap.
The reference must have been obtained via a previous call to insert().
| [in] | data | reference to the element inside the heap to update |
data is a valid reference into this heap. Results are unpredictable (and probably fatal) if this is not the case. Definition at line 557 of file tpl_arrayHeap.H.
References ah_underflow_error_if, Aleph::ArrayHeap< T, Compare >::array, Aleph::ArrayHeap< T, Compare >::cmp, FunctionalMethods< Container, T >::maps(), Aleph::ArrayHeap< T, Compare >::num_items, and Aleph::sift_down_up().
Referenced by TEST().
|
private |
Definition at line 270 of file tpl_arrayHeap.H.
Referenced by Aleph::ArrayHeap< T, Compare >::ArrayHeap(), Aleph::ArrayHeap< T, Compare >::~ArrayHeap(), Aleph::ArrayHeap< T, Compare >::allocate_storage(), Aleph::ArrayHeap< T, Compare >::getMin(), Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::operator=(), Aleph::ArrayHeap< T, Compare >::operator[](), Aleph::ArrayHeap< T, Compare >::operator[](), Aleph::ArrayHeap< T, Compare >::remove(), Aleph::ArrayHeap< T, Compare >::swap(), Aleph::ArrayHeap< T, Compare >::top(), Aleph::ArrayHeap< T, Compare >::top(), Aleph::ArrayHeap< T, Compare >::traverse_impl(), and Aleph::ArrayHeap< T, Compare >::update().
|
mutableprivate |
Definition at line 274 of file tpl_arrayHeap.H.
Referenced by Aleph::ArrayHeap< T, Compare >::~ArrayHeap(), Aleph::ArrayHeap< T, Compare >::allocate_storage(), and Aleph::ArrayHeap< T, Compare >::swap().
|
private |
Definition at line 276 of file tpl_arrayHeap.H.
Referenced by Aleph::ArrayHeap< T, Compare >::getMin(), Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::operator=(), Aleph::ArrayHeap< T, Compare >::remove(), Aleph::ArrayHeap< T, Compare >::swap(), and Aleph::ArrayHeap< T, Compare >::update().
|
mutableprivate |
Definition at line 271 of file tpl_arrayHeap.H.
Referenced by Aleph::ArrayHeap< T, Compare >::allocate_storage(), Aleph::ArrayHeap< T, Compare >::capacity(), Aleph::ArrayHeap< T, Compare >::insert(), Aleph::ArrayHeap< T, Compare >::insert(), Aleph::ArrayHeap< T, Compare >::operator=(), and Aleph::ArrayHeap< T, Compare >::swap().
|
private |
Definition at line 272 of file tpl_arrayHeap.H.
Referenced by Aleph::ArrayHeap< T, Compare >::ArrayHeap(), Aleph::ArrayHeap< T, Compare >::allocate_storage(), Aleph::ArrayHeap< T, Compare >::getMin(), Aleph::ArrayHeap< T, Compare >::insert(), Aleph::ArrayHeap< T, Compare >::insert(), Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::is_empty(), Aleph::ArrayHeap< T, Compare >::operator=(), Aleph::ArrayHeap< T, Compare >::remove(), Aleph::ArrayHeap< T, Compare >::size(), Aleph::ArrayHeap< T, Compare >::swap(), Aleph::ArrayHeap< T, Compare >::top(), Aleph::ArrayHeap< T, Compare >::top(), Aleph::ArrayHeap< T, Compare >::traverse_impl(), and Aleph::ArrayHeap< T, Compare >::update().