|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Dynamic set backed by balanced binary search trees with automatic memory management. More...
#include <tpl_dynSetTree.H>
Inherits LocateFunctions< Container, Type >, FunctionalMethods< Container, T >, GenericItems< Container, T >, EqualSortedMethod< Container >, and StlAlephIterator< SetName >.
Inherited by Aleph::DynMapTree< Key, Type, Avl_Tree, Aleph::less< Key > >, Aleph::DynMapTree< Key, Type, BinTree, Aleph::less< Key > >, Aleph::DynMapTree< Key, Type, Rand_Tree, Aleph::less< Key > >, Aleph::DynMapTree< Key, Type, Rb_Tree, Aleph::less< Key > >, Aleph::DynMapTree< Key, Type, Splay_Tree, Aleph::less< Key > >, Aleph::DynMapTree< Key, Type, Treap, Aleph::less< Key > >, Aleph::DynMapTree< Key, Type, Treap_Rk, Aleph::less< Key > >, Aleph::DynMapTree< Key, Operation >, Aleph::DynMapTree< Key, ValueType >, Aleph::DynMapTree< void *, Flow_Type >, Aleph::DynMapTree< const Aleph::Compiler_Expr *, size_t >, Aleph::DynMapTree< Aleph::Array< size_t >, double, Aleph::Avl_Tree, Grevlex_Order >, Aleph::DynMapTree< size_t, double >, Aleph::DynMapTree< Node *, Node *, Treap >, Aleph::DynMapTree< std::string, Huffman_Node *, Treap_Vtl >, Aleph::DynMapTree< std::string, BitArray, Treap_Vtl >, Aleph::DynMapTree< Node *, size_t >, Aleph::DynMapTree< Node *, Node * >, Aleph::DynMapTree< Arc *, size_t >, Aleph::DynMapTree< Pair_Key, Arc * >, Aleph::DynMapTree< Node *, Aleph::Tree_Node * >, Aleph::DynMapTree< Node *, Aleph::DynSetTree< Node * > >, Aleph::DynMapTree< Arc *, Arc * >, Aleph::DynMapTree< Node *, Cost_Type >, Aleph::DynMapTree< Node *, Arc * >, Aleph::DynMapTree< Event::EventId, TimeoutQueue::Event * >, Aleph::DynSetAvlTree< std::pair< int, int > >, Aleph::DynSetAvlTree< Relation_T::Pair, Relation_T::Cmp >, Aleph::Arcs_Index< GT, Compare, Tree, SA >, Aleph::DynMapTree< Key, Data, Tree, Compare >, Aleph::DynSetAvlRkTree< Key, Compare >, Aleph::DynSetAvlTree< Key, Compare >, Aleph::DynSetBinTree< Key, Compare >, Aleph::DynSetHtdRbRkTree< Key, Compare >, Aleph::DynSetHtdRbTree< Key, Compare >, Aleph::DynSetRandTree< Key, Compare >, Aleph::DynSetRbRkTree< Key, Compare >, Aleph::DynSetRbTree< Key, Compare >, Aleph::DynSetSplayRkTree< Key, Compare >, Aleph::DynSetSplayTree< Key, Compare >, Aleph::DynSetTdRbRkTree< Key, Compare >, Aleph::DynSetTdRbTree< Key, Compare >, Aleph::DynSetTreap< Key, Compare >, Aleph::DynSetTreapRk< Key, Compare >, and Aleph::Nodes_Index< GT, Compare, Tree, SN >.
Classes | |
| struct | Has_Range_Methods |
| struct | Iterator |
| struct | Node_Op |
Public Types | |
| using | Node = typename Tree< Key, Compare >::Node |
| Type of binary node used by the binary search tree internal. | |
| using | Tree_Type = Tree< Key, Compare > |
| typedef DynSetTree | Set_Type |
| typedef Key | Item_Type |
| typedef Key | Key_Type |
| using | Const_Iterator = Aleph::Const_Iterator< Iterator > |
| Read-only iterator: the iterator of a constant set. | |
Public Types inherited from StlAlephIterator< SetName > | |
| using | iterator = StlIterator< SetName > |
| using | const_iterator = StlConstIterator< SetName > |
Public Member Functions | |
| void | swap (DynSetTree &dset) noexcept(noexcept(tree.swap(dset.tree)) and noexcept(std::swap(num_nodes, dset.num_nodes)) and noexcept(std::swap(arena_allocator, dset.arena_allocator))) |
| Exchange all elements of this set with dset in constant time (and extremely fast). | |
| DynSetTree () noexcept(nothrow_empty_tree) | |
| Builds an empty set, with a comparison criteria built by default. | |
| DynSetTree (const Compare &cmp) noexcept(std::is_nothrow_constructible_v< Tree< Key, Compare >, const Compare & >) | |
Builds an empty set with the comparison criteria cmp. | |
| DynSetTree (const char *base_addr, const size_t &sz, const Compare &cmp=Compare()) | |
| Instantiate a dynamic set using an arena allocator with external buffer. | |
| DynSetTree (const size_t &arena_sz, const Compare &cmp=Compare()) | |
| Instantiate a dynamic set using an arena allocator with dynamic buffer. | |
| DynSetTree (const DynSetTree &srcTree) | |
| instantiates a dynamic copy of srcTree | |
| template<template< typename > class List> | |
| DynSetTree (const List< Key > &l) | |
| template<class It > requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; }) | |
| DynSetTree (It b, It e) | |
| DynSetTree (std::initializer_list< Key > l) | |
| DynSetTree (DynSetTree &&srcTree) noexcept(std::is_nothrow_move_constructible_v< Tree< Key, Compare > >) | |
| Take the elements of another set, which is left empty: on a tree that cannot be copied, as those of the library. | |
| DynSetTree (DynSetTree &&srcTree) noexcept(nothrow_empty_tree and noexcept(swap(srcTree))) | |
| Take the elements of another set, which is left empty: on a tree that can be copied, which may have no move of its own. | |
| void | empty () |
| Remove all the elements of the set. | |
| void | clear () |
| Empties the container. | |
| DynSetTree & | operator= (const DynList< Key > &list) |
| DynSetTree & | operator= (const DynSetTree &srcTree) |
Assign a copy of srcTree to this set. | |
| DynSetTree & | operator= (DynSetTree &&srcTree) noexcept(noexcept(swap(srcTree))) |
| Free the elements of this set, and take those of another, which is left empty. | |
| virtual | ~DynSetTree () |
| Destroyer; all elements are released. | |
| Key * | insert (const Key &key) |
| Inserts a key into the dynamic set. | |
| Key * | insert (Key &&key) |
| Key * | append (const Key &key) |
| Key * | append (Key &&key) |
| Key * | search_or_insert (const Key &key) |
| Look for the key in the binary search tree or inserts it if it is not found. | |
| Key * | search_or_insert (Key &&key) |
| std::pair< Key *, bool > | contains_or_insert (const Key &key) |
| std::pair< Key *, bool > | contains_or_insert (Key &&key) |
| Key * | insert_dup (const Key &key) |
| Key * | insert_dup (Key &&key) |
| Key * | put (const Key &key) |
| Key * | put (Key &&key) |
| size_t | remove (const Key &key) |
| Removes a key from the dynamic set. | |
| Key | del (const Key &key) |
Deletes key and returns a full copy of stored key. | |
| Key | remove_pos (const size_t i) |
Removes the key at the inorder position i. | |
| bool | exist (const Key &key) const |
| Returns true if key belongs to the dynamic set. | |
| bool | has (const Key &key) const |
| bool | contains (const Key &key) const |
| Checks if a key exists in the set. | |
| Key & | find (const Key &key) |
| Returns a modifiable reference to an element within the set. | |
| const Key & | find (const Key &key) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const. | |
| std::pair< long, Key * > | find_position (const Key &key) const |
| Returns the infix (ordinate) position of the key key or whatever It would be your position of belonging to the tree. | |
| Key * | search (const Key &key) |
| Find an element in the set. | |
| const Key * | search (const Key &key) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A pointer to const. | |
| const Key & | min () const |
| Returns the smallest key contained in the set according to the criterion comparison given. | |
| const Key & | get_first () const |
See min. | |
| const Key & | max () const |
| Returns the largest key contained in the set according to the criteria comparison given. | |
| const Key & | get_last () const |
See max. | |
| const Key & | get () const |
| Synonym of max. | |
| const size_t & | size () const |
| Returns the cardinality of the set. | |
| bool | is_empty () const |
| returns true if the set is empty | |
| bool | uses_arena () const noexcept |
| Returns true if the set is using an arena allocator. | |
| size_t | arena_allocated_size () const noexcept |
| Returns the allocated size from the arena (0 if not using arena) | |
| size_t | arena_available_size () const noexcept |
| Returns the available size in the arena (0 if not using arena) | |
| size_t | internal_path_length () const |
| Calculates and returns the length of the internal path of the tree search binary. | |
| Node * | get_root_node () const |
| const Key & | get_root () const |
| const Key & | get_item () const |
| Returns any element of the set. | |
| size_t | height () const |
| Calculates and returns the height of the binary search tree. | |
| template<class Op > | |
| void | for_each_in_preorder (void(*visitFct)(Node *, int, int)) |
Performs a prefix traversal over all nodes in the tree and invokes the visitFct operation on each visit. | |
| long | position (const Key &key) const |
| Returns the infix (ordered) position of the key. | |
| Key & | select (size_t i) |
| Returns the ith node in infix position. | |
| const Key & | select (size_t i) const |
| Key & | operator() (size_t i) |
| const Key & | operator[] (const Key &key) const |
| const Key & | operator[] (const Key &key) |
| Key & | access (size_t i) |
| bool | verify () const |
| template<class Key_Op > | |
| void | for_each_preorder (Key_Op &key_op) const |
| Performs a prefix traversal over all keys in the set and invokes operation Op. | |
| template<class Key_Op > | |
| void | for_each_preorder (Key_Op &&key_op=Key_Op()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Performs a preorder traversal over all keys using a temporary operation object. | |
| template<class Key_Op > | |
| void | for_each_inorder (Key_Op &key_op) const |
| Performs an infix traversal over all keys in the set and invokes operation Op. | |
| template<class Key_Op > | |
| void | for_each_inorder (Key_Op &&key_op=Key_Op()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Performs an infix traversal over all keys using a temporary operation object. | |
| template<class Key_Op > | |
| void | for_each_postorder (Key_Op &key_op) const |
| Performs a postfix traversal over all keys in the set and invokes operation Op. | |
| template<class Key_Op > | |
| void | for_each_postorder (Key_Op &&key_op=Key_Op()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Performs a postorder traversal over all keys using a temporary operation object. | |
| DynSetTree & | join (DynSetTree &t, DynSetTree &dup) |
| Union of two binary search trees. | |
| DynSetTree & | join (DynSetTree &t, DynSetTree &&dup=DynSetTree()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Union of two binary search trees using a move-constructed duplicate tree. | |
| DynSetTree & | join_dup (DynSetTree &t) |
| Union of two binary search trees. | |
| bool | split_key (const Key &key, DynSetTree &l, DynSetTree &r) |
| Partitions the binary search tree based on a key. | |
| void | split_pos (const size_t pos, DynSetTree &l, DynSetTree &r) |
| Partitions the binary search tree based on an infix position. | |
| void | split_key_dup (const Key &key, DynSetTree &l, DynSetTree &r) |
| Partitions the binary search tree based on a key that may be present in the tree. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Key &> | |
| bool | traverse (Operation &op) |
| Traverse all the set of pairs and for each key executes the operation op. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Key &> | |
| bool | traverse (Operation &&op=Operation()) |
See traverse(Operation & op). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const Key &> | |
| bool | traverse (Operation &op) const |
| Traverse a constant set in order; each key is handed out as a constant reference. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const Key &> | |
| bool | traverse (Operation &&op=Operation()) const |
See traverse(Operation & op) const. | |
| Compare | key_comp () const |
| Return a copy of the comparator that orders the keys. | |
Public Member Functions inherited from LocateFunctions< Container, Type > | |
| auto | get_it () |
| Return a properly initialized iterator positioned at the first item on the container. | |
| auto | get_it () const |
| Read-only iterator positioned at the first item. | |
| auto | get_it (const size_t pos) |
Return a properly initialized iterator positioned at the pos item on the container. | |
| auto | get_it (const size_t pos) const |
Read-only iterator positioned at the pos item. | |
| auto | get_itor () |
Alias of get_it(). | |
| auto | get_itor () const |
See get_itor(). | |
| template<class C = Container> requires Aleph::dry_detail::MutablyTraversable<C, Type> | |
| Type & | nth_ne (const size_t n) noexcept(Aleph::dry_detail::mutable_traversal_is_noexcept< C, Type >) |
| Return the n‑th element without bounds checking. | |
| const Type & | nth_ne (const size_t n) const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< Container, Type >) |
Constant overload of nth_ne(size_t). | |
| template<class C = Container> requires Aleph::dry_detail::MutablyTraversable<C, Type> | |
| Type & | nth (const size_t n) |
| Return the n-th item of the container. | |
| const Type & | nth (const size_t n) const |
Const overload of nth(size_t). | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, Type &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, Type > Type * | find_ptr (Operation &operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Find a pointer to an item in the container according to a searching criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| const Type * | find_ptr (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
Const overload of find_ptr(Operation&). | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| const Type * | find_ptr (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_ptr() const that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, Type &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, Type > Type * | find_ptr (Operation &&operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Overload of find_ptr() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| size_t | find_index (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Find the position of an item in the container according to a searching criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| size_t | find_index (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_index() that accepts rvalues. | |
| template<class Operation , class T = Type> requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, Type > | find_item (Operation &operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Safe sequential searching of an item matching a criterion. | |
| template<class Operation , class T = Type> requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, Type > | find_item (Operation &&operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Overload of find_item() that accepts rvalues. | |
| template<class Operation , class T = Type> requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| and std::copy_constructible< T > std::optional< Type > | find_opt (Operation &operation) const |
| Copy of the first item satisfying a criterion, if any. | |
| template<class Operation , class T = Type> requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| and std::copy_constructible< T > std::optional< Type > | find_opt (Operation &&operation) const |
| Overload of find_opt() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const Type &> | |
| bool | contains_if (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Test if an item satisfying a criterion is present in the container. | |
| template<class T = Type> requires requires(const T & a, const T & b) { { a == b } -> std::convertible_to<bool>; } | |
| bool | contains (const Type &item) const |
| Test if an item is present in the container using equality. | |
Public Member Functions inherited from FunctionalMethods< Container, T > | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it from the given args. | |
| void | emplace_end (Args &&... args) |
See emplace(Args && ... args). | |
| void | emplace_ins (Args &&... args) |
| template<typename... Args> requires ((std::convertible_to<Args &&, T> and ...) and (Aleph::InsertableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type, Item_Arg<Args>> and ...)) | |
| size_t | ninsert (Args &&... args) |
| Insert n variadic items. | |
| template<typename... Args> requires ((std::convertible_to<Args &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type, Item_Arg<Args>> and ...)) | |
| size_t | nappend (Args &&... args) |
| Append n variadic items. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | for_each (Operation &operation) const |
| Traverse all the container and performs an operation on each element. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | for_each (Operation &&operation) const |
| Overload of for_each() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &operation) const |
| Alias of for_each(). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &&operation) const |
| Alias of for_each() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing an operation on each visited element. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &operation) |
Traverse the container starting at pos taking one item every slice, performing an operation that may modify each visited item. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | mutable_for_each (Operation &operation) |
| Apply a mutable operation to each element of the container. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | mutable_for_each (Operation &&operation) |
See mutable_for_each(Operation & operation). | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | all (Operation &operation) const |
| Check if all the elements of the container satisfy a condition. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | all (Operation &&operation) const |
| Overload of all() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | exists (Operation &&op) const |
| Overload of exists() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | none (Operation &op) const |
| Test that no element satisfies a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | none (Operation &&op) const |
| Overload of none() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| size_t | count_if (Operation &op) const |
| Count the elements that satisfy a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| size_t | count_if (Operation &&op) const |
| Overload of count_if() that accepts rvalues. | |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &&op) const |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| auto | flat_map (Operation &op) const |
| Map each element to a container and concatenate the results. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| auto | flat_map (Operation &&op) const |
| Overload of flat_map() 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 Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | foldl (const Acc &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | foldl (const Acc &init, Op &&op) const |
| Overload of foldl() that accepts rvalues. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | fold_left (const Acc &init, Op &op) const |
| Alias for foldl(). | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | fold_left (const Acc &init, Op &&op) const |
| Overload of fold_left() that accepts rvalues. | |
| template<class Operation > requires Aleph::dry_detail::FoldOperation<Operation, T, T> | |
| 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 > requires Aleph::dry_detail::FoldOperation<Operation, T, T> | |
| T | fold (const T &init, Operation &&operation) const |
| Overload of fold() that accepts rvalues. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldRightOperation<Op, Acc, T> | |
| Acc | foldr (const Acc &init, Op &op) const |
| Fold the elements from the last to the first. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldRightOperation<Op, Acc, T> | |
| Acc | foldr (const Acc &init, Op &&op) const |
| Overload of foldr() that accepts rvalues. | |
| template<class Op , class U = T> requires Aleph::dry_detail::FoldOperation<Op, T, T> | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &op) const |
| Fold the elements with no initial value. | |
| template<class Op , class U = T> requires Aleph::dry_detail::FoldOperation<Op, T, T> | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &&op) const |
| Overload of reduce() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
| Overload of filter() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and return a pointer to the matched items in the container. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
| Overload of ptr_filter() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and determine its positions respect to the traversal of container. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
| Overload of pfilter() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
| Overload of partition() that accepts rvalues. | |
| 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 > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
| Overload of tpartition() that accepts rvalues. | |
| size_t | length () const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< Container, T >) |
| 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 the elements at positions i, i + step, i + 2 step, ... that are not greater than j, respect to the traversal order. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | take_while (Operation &op) const |
| The longest prefix of elements that satisfy a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | take_while (Operation &&op) const |
| Overload of take_while() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | drop_while (Operation &op) const |
| The elements after the longest prefix that satisfies a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | drop_while (Operation &&op) const |
| Overload of drop_while() that accepts rvalues. | |
| template<class C = Container> requires requires (C & c) { c.remove(); } | |
| 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 |
See items(). | |
Public Member Functions inherited from EqualSortedMethod< Container > | |
| bool | equal_to (const Container &r) const |
Equality test between this and r. | |
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. | |
Protected Member Functions | |
| decltype(auto) | get_compare () const noexcept(noexcept(tree.get_compare())) |
| The comparator that orders the keys, as the tree gives it. | |
Private Member Functions | |
| Node * | alloc_node (const Key &key) |
| Node * | alloc_node (Key &&key) |
| void | free_node (Node *p) |
| void | pin_arena () noexcept |
| Pin the arena, if any: nodes of this set are going to another one. | |
| Key | release (Node *p) |
| Key * | __insert (Node *p) |
| Key * | __search_or_insert (Node *p) |
| std::pair< Node *, bool > | __contains_or_insert (Node *p) |
| Key * | __insert_dup (Node *q) |
Static Private Member Functions | |
| template<typename T > | |
| static auto | call_select (const T &t, const size_t i, int) -> decltype(t.select(i)) |
| template<typename T > | |
| static auto | call_select_nc (T &t, const size_t i, int) -> decltype(t.select(i)) |
| template<typename T > | |
| static Node * | call_select (const T &, const size_t,...) |
| template<typename T > | |
| static Node * | call_select_nc (T &, const size_t,...) |
| template<typename T > | |
| static auto | call_remove_pos (T &t, const size_t i, int) -> decltype(t.remove_pos(i)) |
| template<typename T > | |
| static Node * | call_remove_pos (T &, const size_t,...) |
| template<typename T > | |
| static auto | call_split_pos (T &t, const size_t pos, T &l, T &r, int) -> decltype(t.split_pos(pos, l, r), void()) |
| template<typename T > | |
| static void | call_split_pos (T &, const size_t, T &, T &,...) |
| template<typename T > | |
| static auto | call_position (const T &t, const Key &key, int) -> decltype(t.position(key)) |
| template<typename T > | |
| static std::pair< long, Node * > | call_position (const T &, const Key &,...) |
| template<typename T > | |
| static auto | call_find_position (const T &t, const Key &key, int) -> decltype(t.find_position(key)) |
| template<typename T > | |
| static std::pair< long, Node * > | call_find_position (const T &, const Key &,...) |
Private Attributes | |
| Tree< Key, Compare > | tree |
| size_t | num_nodes |
| std::unique_ptr< ArenaTreeAllocator< Node > > | arena_allocator |
Static Private Attributes | |
| static constexpr size_t | dim = 13 |
| static constexpr bool | nothrow_empty_tree |
| Whether building an empty tree with a comparison built by default throws nothing. | |
Additional Inherited Members | |
Static Public Member Functions inherited from FunctionalMethods< Container, T > | |
| template<typename... Items> requires ((std::convertible_to<Items &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Items...>>::type, Item_Arg<Items>> and ...)) | |
| static Container | build (Items &&... items) |
| Build a container that holds the given items. | |
| template<class D , typename... Items> requires (std::derived_from<D, typename Aleph::concepts_detail::defer<Container, D>::type> and std::default_initializable<D> and (std::convertible_to<Items &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<D, Items...>>::type, Item_Arg<Items>> and ...)) | |
| static D | build_as (Items &&... items) |
Build a D, a class derived from the container, holding the given items. | |
Public Attributes inherited from FunctionalMethods< Container, T > | |
| template<typename... Args> requires (typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type & c, T && x) | |
| and { c.append(std::move(x)) | |
| Insert a new element into the container by constructing it from the given args. | |
| template<typename R = void, class Prop , class Operation > requires (Aleph::DynList<Aleph::dry_detail::map_result_t<R, Operation &, T>> & l, Operation & op, const T & item) | |
| and Aleph::InvocableWith< Operation &, const T & > | and { l.append(std::invoke(op, item)) |
| Conditional mapping of the elements of the container. | |
Dynamic set backed by balanced binary search trees with automatic memory management.
DynSetTree<Key, Tree, Compare> is a high-level dynamic set container that uses any of several balanced BST implementations (AVL, Red-Black, Treap, Splay, etc.) to maintain a sorted collection of unique keys.
Unlike the low-level tree classes (e.g., Avl_Tree, Rb_Tree), DynSetTree automatically manages node memory, provides rich functional operations (map, filter, fold), and offers an STL-compatible interface.
| Key | The type of keys stored in the set. |
| Tree | The underlying tree implementation template (default: Avl_Tree). Can be Avl_Tree, Rb_Tree, Treap, TreapRk, Splay_Tree, Rand_Tree. |
| Compare | Comparison functor for ordering keys (default: Aleph::less<Key>). |
Definition at line 358 of file tpl_dynSetTree.H.
| using Aleph::DynSetTree< Key, Tree, Compare >::Const_Iterator = Aleph::Const_Iterator<Iterator> |
Read-only iterator: the iterator of a constant set.
Definition at line 1691 of file tpl_dynSetTree.H.
| typedef Key Aleph::DynSetTree< Key, Tree, Compare >::Item_Type |
Definition at line 536 of file tpl_dynSetTree.H.
| typedef Key Aleph::DynSetTree< Key, Tree, Compare >::Key_Type |
Definition at line 538 of file tpl_dynSetTree.H.
| using Aleph::DynSetTree< Key, Tree, Compare >::Node = typename Tree<Key, Compare>::Node |
Type of binary node used by the binary search tree internal.
Definition at line 368 of file tpl_dynSetTree.H.
| typedef DynSetTree Aleph::DynSetTree< Key, Tree, Compare >::Set_Type |
Definition at line 534 of file tpl_dynSetTree.H.
| using Aleph::DynSetTree< Key, Tree, Compare >::Tree_Type = Tree<Key, Compare> |
Definition at line 370 of file tpl_dynSetTree.H.
|
inlinenoexcept |
Builds an empty set, with a comparison criteria built by default.
It is a constructor apart from the one that takes the comparison, and it builds the comparison itself, instead of leaving it to a default argument: GCC and Clang do not count a default argument in the noexcept of an implicit default constructor, as that of a class that inherits the constructors of this one, or that of a tree that inherits its own, and what the construction of the comparison threw would end the program there.
| what | the default construction of the comparison throws, or what building the tree throws: the default construction of the key of its header nodes or the copy of the comparison. The constructor is noexcept exactly when none of them may throw. |
Definition at line 585 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::operator=().
|
inlinenoexcept |
Builds an empty set with the comparison criteria cmp.
| [in] | cmp | the comparison criteria, which the tree copies. |
| what | building the tree throws: the default construction of the key of its header nodes or the copy of cmp. The constructor is noexcept exactly when none of them may throw. |
Definition at line 597 of file tpl_dynSetTree.H.
|
inline |
Instantiate a dynamic set using an arena allocator with external buffer.
Definition at line 606 of file tpl_dynSetTree.H.
|
inlineexplicit |
Instantiate a dynamic set using an arena allocator with dynamic buffer.
Definition at line 615 of file tpl_dynSetTree.H.
|
inline |
instantiates a dynamic copy of srcTree
Definition at line 624 of file tpl_dynSetTree.H.
References Aleph::copyRec(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Definition at line 639 of file tpl_dynSetTree.H.
|
inline |
Definition at line 639 of file tpl_dynSetTree.H.
|
inline |
Definition at line 639 of file tpl_dynSetTree.H.
|
inlinenoexcept |
Take the elements of another set, which is left empty: on a tree that cannot be copied, as those of the library.
The tree of this set takes the nodes of that of srcTree, with the move constructor of the tree, which leaves the tree that it moves from without nodes. No tree is built for srcTree, and no comparison by default. A tree that can be copied may have no move of its own, and the copy would leave its nodes in the two sets: the set moves it as the other constructor says.
| [in,out] | srcTree | the set to move from. It can take elements again, in the order of its comparison criteria, which it keeps: the tree copies them, if they can be copied. A set with an arena allocator gives it away, and allocates its nodes with new from then on. |
| what | the move of the tree throws: the copy of the comparison criteria, or their move if they cannot be copied; and, on a tree with header nodes, the default construction of a key, with a key whose move may throw too. Then srcTree keeps its elements. The move is noexcept exactly when that of the tree is: with comparison criteria whose copy cannot throw and, on a tree with header nodes, a key that can be built by default without throwing or moved without throwing. The key of a map is the pair of a key and a value: both built so, or both moved so. |
Definition at line 672 of file tpl_dynSetTree.H.
|
inlinenoexcept |
Take the elements of another set, which is left empty: on a tree that can be copied, which may have no move of its own.
It builds an empty tree, with comparison criteria built by default, and swaps the two sets: the nodes go to this set alone, whatever the tree does when it is moved.
| [in,out] | srcTree | the set to move from. It keeps the empty tree, with the comparison criteria of this one, and can take elements again. |
| what | building the empty tree throws: the default construction of the comparison criteria and their copy, or the default construction of the key of a header node; or what swapping the trees throws. Then srcTree keeps its elements. The move is noexcept when none of them may throw. |
Definition at line 699 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::swap().
|
inlinevirtual |
Destroyer; all elements are released.
Definition at line 798 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::empty().
|
inlineprivate |
Definition at line 892 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::contains_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::contains_or_insert().
|
inlineprivate |
Definition at line 804 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::insert(), and Aleph::DynSetTree< Key, Tree, Compare >::insert().
|
inlineprivate |
Definition at line 963 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::insert_dup(), and Aleph::DynSetTree< Key, Tree, Compare >::insert_dup().
|
inlineprivate |
Definition at line 871 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::search_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::search_or_insert().
|
inline |
Definition at line 1339 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::select().
Referenced by Aleph::compiler_bind_module_surfaces(), and TEST().
|
inlineprivate |
Definition at line 484 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::contains_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::contains_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert_dup(), Aleph::DynSetTree< Key, Tree, Compare >::insert_dup(), Aleph::DynSetTree< Key, Tree, Compare >::search_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::search_or_insert().
|
inlineprivate |
Definition at line 491 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
|
inline |
Definition at line 860 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::insert().
Referenced by Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::insert_arc(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::insert_node(), main(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Definition at line 865 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::insert().
|
inlinenoexcept |
Returns the allocated size from the arena (0 if not using arena)
Definition at line 1222 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
Referenced by TEST().
|
inlinenoexcept |
Returns the available size in the arena (0 if not using arena)
Definition at line 1230 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
Referenced by TEST().
|
inlinestaticprivate |
Definition at line 472 of file tpl_dynSetTree.H.
References ah_domain_error.
|
inlinestaticprivate |
Definition at line 465 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::find_position().
|
inlinestaticprivate |
Definition at line 458 of file tpl_dynSetTree.H.
References ah_domain_error.
|
inlinestaticprivate |
Definition at line 451 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::position().
|
inlinestaticprivate |
Definition at line 431 of file tpl_dynSetTree.H.
References ah_domain_error.
|
inlinestaticprivate |
Definition at line 424 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::remove_pos().
|
inlinestaticprivate |
Definition at line 410 of file tpl_dynSetTree.H.
References ah_domain_error.
|
inlinestaticprivate |
Definition at line 395 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::select().
|
inlinestaticprivate |
Definition at line 417 of file tpl_dynSetTree.H.
References ah_domain_error.
|
inlinestaticprivate |
Definition at line 403 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::select().
|
inlinestaticprivate |
Definition at line 445 of file tpl_dynSetTree.H.
References ah_domain_error.
|
inlinestaticprivate |
Definition at line 438 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::split_pos().
|
inline |
Empties the container.
| none |
Definition at line 747 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::empty().
|
inline |
Checks if a key exists in the set.
| [in] | key | key to search for. |
| none |
Definition at line 1081 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::exist().
Referenced by Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_underlying_simple_graph(), Aleph::check_baseball_elimination(), demonstrate_basic_operations(), Aleph::k_shortest_paths_detail::generate_general_deviation_candidates(), Aleph::hopcroft_karp_matching(), Aleph::Net_Sup_Dem_Graph< SimpleNode, SimpleArc >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::is_sink(), Aleph::min_cut(), Aleph::nonplanar_certificate_to_dot(), Aleph::nonplanar_certificate_to_gexf(), Aleph::nonplanar_certificate_to_graphml(), Aleph::k_shortest_paths_detail::Filtered_Show_Arc< GT, SA >::operator()(), Aleph::planar_dual_metadata(), Aleph::planar_geometric_drawing(), Aleph::segment_image(), Aleph::k_shortest_paths_detail::shortest_path_filtered(), Aleph::solve_project_selection(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::validate_nonplanar_certificate(), verify_bipartition(), and verify_matching().
|
inline |
Definition at line 950 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__contains_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::alloc_node().
Referenced by TYPED_TEST().
|
inline |
Definition at line 956 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__contains_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::alloc_node().
|
inline |
Deletes key and returns a full copy of stored key.
This method is intended to be used with compound keys, by example pairs, whose searching is done by a particular member of compound data.
| [in] | key | key to be removed |
| domain_error | if the key is not found in the set |
| anything | that the copy of the stored key throws; the key leaves the set anyway, so that size() counts the keys that remain. |
Definition at line 1030 of file tpl_dynSetTree.H.
References ah_domain_error_if, Aleph::DynSetTree< Key, Tree, Compare >::release(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynMapTree< Key, Data, Tree, Compare >::remove(), and Aleph::DynMapTree< Key, Data, Tree, Compare >::remove().
|
inline |
Remove all the elements of the set.
Definition at line 716 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator, Aleph::callKeyDestructorsRec(), Aleph::destroyRec(), Aleph::dispose_tree_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, Aleph::DynSetTree< Key, Tree, Compare >::release(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::~DynSetTree(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::build_adjacency(), Aleph::Huffman_Encoder_Engine::build_encoding_map(), Aleph::MCF_Graph< NodeT, ArcT >::build_node_index(), Aleph::DynSetTree< Key, Tree, Compare >::clear(), Aleph::AHMapping< Key, ValueType >::clear(), Aleph::Huffman_Encoder_Engine::clear_build_state(), Aleph::planarity_detail::collect_certificate_nodes(), Aleph::Huffman_Encoder_Engine::generate_huffman_tree(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), Aleph::DynSetTree< Key, Tree, Compare >::operator=(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::prepare_new_graph(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::prepare_new_graph(), reset_huffman_btreepic_state(), TEST(), and test_DynSet().
|
inline |
Returns true if key belongs to the dynamic set.
Definition at line 1065 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::search().
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynSetTree< Key, Tree, Compare >::has(), and TYPED_TEST().
|
inline |
Returns a modifiable reference to an element within the set.
find(key) looks for the key key in the set and returns a modifiable reference to the value contained in the set.
| [in] | key | key to search for. |
| domain_error | if key is not within the set. |
Definition at line 1100 of file tpl_dynSetTree.H.
References ah_domain_error_if, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::operator[](), Aleph::Arcs_Index< GT, Compare, Tree, SA >::remove_from_graph(), and Aleph::Nodes_Index< GT, Compare, Tree, SN >::remove_from_graph().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
Definition at line 1110 of file tpl_dynSetTree.H.
References ah_domain_error_if, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Returns the infix (ordinate) position of the key key or whatever It would be your position of belonging to the tree.
find_position(key) searches the extended tree for the key key (which takes time \(O(\lg n)\)) and returns the position infix of the node containing the key.
| [in] | key | key to search for and determine infix position. |
Definition at line 1132 of file tpl_dynSetTree.H.
References ah_domain_error_if_constexpr, Aleph::DynSetTree< Key, Tree, Compare >::call_find_position(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Performs a prefix traversal over all nodes in the tree and invokes the visitFct operation on each visit.
Definition at line 1262 of file tpl_dynSetTree.H.
References Aleph::preOrderRec(), root(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Performs an infix traversal over all keys using a temporary operation object.
| Key_Op | Operation type (default-constructible). |
| [in] | key_op | Operation to execute on each key (default-constructed if not provided). |
Definition at line 1461 of file tpl_dynSetTree.H.
|
inline |
Performs an infix traversal over all keys in the set and invokes operation Op.
Op(p) has the following structure:
| [in] | key_op | operation to execute on each key |
Definition at line 1444 of file tpl_dynSetTree.H.
References root(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Performs a postorder traversal over all keys using a temporary operation object.
| Key_Op | Operation type (default-constructible). |
| [in] | key_op | Operation to execute on each key (default-constructed if not provided). |
Definition at line 1508 of file tpl_dynSetTree.H.
|
inline |
Performs a postfix traversal over all keys in the set and invokes operation Op.
Op(p) has the following structure:
| [in] | key_op | operation to execute on each key |
Definition at line 1491 of file tpl_dynSetTree.H.
References root(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Performs a preorder traversal over all keys using a temporary operation object.
| Key_Op | Operation type (default-constructible). |
| [in] | key_op | Operation to execute on each key (default-constructed if not provided). |
Definition at line 1414 of file tpl_dynSetTree.H.
|
inline |
Performs a prefix traversal over all keys in the set and invokes operation Op.
Op(p) has the following structure:
| [in] | key_op | operation to execute on each key |
Definition at line 1397 of file tpl_dynSetTree.H.
References root(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inlineprivate |
Definition at line 498 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::__contains_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::__insert(), Aleph::DynSetTree< Key, Tree, Compare >::__insert_dup(), Aleph::DynSetTree< Key, Tree, Compare >::__search_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::empty(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::release(), and Aleph::DynSetTree< Key, Tree, Compare >::remove().
|
inline |
Synonym of max.
Definition at line 1207 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::max().
Referenced by TEST(), and TYPED_TEST().
|
inlineprotectednoexcept |
The comparator that orders the keys, as the tree gives it.
For a derived class that searches by a part of the key, as DynMapTree, which compares a key with the first member of each pair instead of building a pair to search for.
| anything | that get_compare() of the tree throws, as the copy of a comparator that it gives by value. |
Definition at line 1776 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynMapTree< Key, Data, Tree, Compare >::search_pair().
|
inline |
See min.
Definition at line 1191 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::min().
Referenced by Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::get_first_arc(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::get_first_node(), TEST(), and TYPED_TEST().
|
inline |
Returns any element of the set.
Definition at line 1254 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::get_root().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), TEST(), and TYPED_TEST().
|
inline |
See max.
Definition at line 1204 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::max().
Referenced by TEST(), and TYPED_TEST().
|
inline |
Definition at line 1246 of file tpl_dynSetTree.H.
References ah_domain_error_if, KEY, Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::get_item(), and TEST().
|
inline |
Definition at line 1244 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by demonstrate_tree_types(), Aleph::DynMapTree< Key, Data, Tree, Compare >::search_pair(), and TYPED_TEST().
|
inline |
Definition at line 1070 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::exist().
Referenced by insert_n_random_items_in_set(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), and TYPED_TEST().
|
inline |
Calculates and returns the height of the binary search tree.
Definition at line 1257 of file tpl_dynSetTree.H.
References Aleph::computeHeightRec(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by TEST(), TEST(), test(), and TYPED_TEST().
|
inline |
Inserts a key into the dynamic set.
Inserts the key into the dynamic set.
| [in] | key | key to insert. |
Definition at line 834 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__insert(), Aleph::DynSetTree< Key, Tree, Compare >::alloc_node(), and Aleph::DynSetTree< Key, Tree, Compare >::free_node().
Referenced by Aleph::Two_Sat< GT >::add_at_most_one(), Aleph::DynSetTree< Key, Tree, Compare >::append(), Aleph::DynMapTree< Key, Data, Tree, Compare >::append(), Aleph::DynMapTree< Key, Data, Tree, Compare >::append(), Aleph::DynSetTree< Key, Tree, Compare >::append(), Aleph::DynMapTree< Key, Data, Tree, Compare >::append(), Aleph::DynMapTree< Key, Data, Tree, Compare >::append(), Aleph::build_combs(), Aleph::MonotonePolygonTriangulation::build_faces_from_diagonals(), Aleph::k_shortest_paths_detail::build_suffix_index_digraph(), Aleph::k_shortest_paths_detail::build_suffix_index_with_itor(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_underlying_simple_graph(), Aleph::SweepLineSegmentIntersection::check_and_enqueue(), Aleph::check_baseball_elimination(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::check_beyond_max(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::check_beyond_max(), Aleph::compute_min_cut(), count_distinct_colors(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::create_nodes_and_initialize_arc_index(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::create_nodes_and_initialize_arc_index(), create_table(), Aleph::MonotonePolygonTriangulation::decompose_to_monotone_faces(), demonstrate_basic_operations(), demonstrate_functional_features(), demonstrate_ranked_operations(), demonstrate_tree_types(), Aleph::dsatur_coloring(), Aleph::BruteForceConvexHull::extreme_edges(), Aleph::k_shortest_paths_detail::for_each_left_out(), Aleph::greedy_coloring(), Aleph::hopcroft_karp_matching(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::init(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::init(), Aleph::CuttingEarsTriangulation::init_ears(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::insert_in_graph(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::insert_in_graph(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::insert_in_graph(), insert_n_random_items_in_set(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), main(), Aleph::min_cut(), Aleph::nonplanar_certificate_to_dot(), Aleph::nonplanar_certificate_to_gexf(), Aleph::nonplanar_certificate_to_graphml(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::CuttingEarsTriangulation::operator()(), Aleph::Init_P< GT >::operator()(), Aleph::planar_dual_metadata(), Aleph::planar_geometric_drawing(), Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA >::post_dominance_frontiers(), Aleph::DynSetTree< Key, Tree, Compare >::put(), Aleph::DynSetTree< Key, Tree, Compare >::put(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), Aleph::Net_Graph< NodeT, ArcT >::register_node(), Aleph::segment_image(), Aleph::set_unify(), Aleph::solve_project_selection(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), Aleph::to_DynSetTree(), Aleph::GeomBowyerWatsonUtils::toggle_edge(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::update_parity_after_arc_insertion(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::update_parity_after_arc_insertion(), Aleph::validate_nonplanar_certificate(), Aleph::vector_to_DynSetTree(), verify_bipartition(), verify_matching(), Aleph::welsh_powell_coloring(), and Aleph::yen_k_shortest_paths().
|
inline |
Definition at line 847 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__insert(), Aleph::DynSetTree< Key, Tree, Compare >::alloc_node(), and Aleph::DynSetTree< Key, Tree, Compare >::free_node().
|
inline |
Definition at line 979 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__insert_dup(), and Aleph::DynSetTree< Key, Tree, Compare >::alloc_node().
Referenced by insert_dup_traversal_test(), TEST(), and TYPED_TEST().
|
inline |
Definition at line 984 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__insert_dup(), and Aleph::DynSetTree< Key, Tree, Compare >::alloc_node().
|
inline |
Calculates and returns the length of the internal path of the tree search binary.
Definition at line 1239 of file tpl_dynSetTree.H.
References Aleph::internal_path_length(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by test(), and TYPED_TEST().
|
inline |
returns true if the set is empty
Definition at line 1213 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::num_nodes.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), Aleph::dsatur_coloring(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::k_shortest_paths_detail::generate_general_deviation_candidates(), AHDispatcher< Key, Operation >::is_empty(), Aleph::CuttingEarsTriangulation::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TYPED_TEST(), and TYPED_TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Union of two binary search trees using a move-constructed duplicate tree.
| [in] | t | Binary search tree to join with this. |
| [in] | dup | Binary search tree with duplicate keys (move-constructed, default empty). |
Definition at line 1552 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::join().
|
inline |
Return a copy of the comparator that orders the keys.
std::set::key_comp() does. | anything | that the copy of Compare throws. |
Definition at line 1757 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Returns the largest key contained in the set according to the criteria comparison given.
Definition at line 1195 of file tpl_dynSetTree.H.
References ah_domain_error_if, Aleph::find_max(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by demonstrate_basic_operations(), Aleph::DynSetTree< Key, Tree, Compare >::get(), Aleph::DynSetTree< Key, Tree, Compare >::get_last(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
|
inline |
Returns the smallest key contained in the set according to the criterion comparison given.
Definition at line 1182 of file tpl_dynSetTree.H.
References ah_domain_error_if, Aleph::find_min(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by demonstrate_basic_operations(), Aleph::DynSetTree< Key, Tree, Compare >::get_first(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
|
inline |
Definition at line 1324 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::select().
|
inline |
Definition at line 749 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::DynSetTree().
|
inline |
Assign a copy of srcTree to this set.
The keys are copied together with the comparison criterion of srcTree, as the copy constructor does, so that a criterion with state orders this set as it orders srcTree. The copy is built apart and then swapped in: if it fails, this set is left as it was.
| [in] | srcTree | the set to copy |
| bad_alloc | if there is no enough memory |
new. A set that was using an arena allocator releases its arena and no longer uses one. Definition at line 767 of file tpl_dynSetTree.H.
References Aleph::copy(), and Aleph::DynSetTree< Key, Tree, Compare >::swap().
|
inlinenoexcept |
Free the elements of this set, and take those of another, which is left empty.
| [in,out] | srcTree | the set to move from. |
| what | swapping the trees throws: the comparison of a tree may have a swap of its own that throws. The assignment is noexcept exactly when that swap is. |
Definition at line 786 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::empty(), and Aleph::DynSetTree< Key, Tree, Compare >::swap().
|
inline |
Definition at line 1334 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::search_or_insert().
|
inline |
Definition at line 1329 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::find().
|
inlineprivatenoexcept |
Pin the arena, if any: nodes of this set are going to another one.
Definition at line 507 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::join(), Aleph::DynSetTree< Key, Tree, Compare >::join_dup(), Aleph::DynSetTree< Key, Tree, Compare >::split_key(), Aleph::DynSetTree< Key, Tree, Compare >::split_key_dup(), and Aleph::DynSetTree< Key, Tree, Compare >::split_pos().
|
inline |
Returns the infix (ordered) position of the key.
position(key) searches the tree for the key (which takes time \(O(\lg n)\)) and returns the infix position of the node containing the key.
| [in] | key | key to search for and determine infix position. |
Definition at line 1280 of file tpl_dynSetTree.H.
References ah_domain_error_if_constexpr, Aleph::DynSetTree< Key, Tree, Compare >::call_position(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by demonstrate_ranked_operations(), TEST(), and TEST().
|
inline |
Definition at line 989 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::insert().
Referenced by TYPED_TEST(), and TYPED_TEST().
|
inline |
Definition at line 994 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::insert().
|
inlineprivate |
Definition at line 516 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::free_node(), and Aleph::DynSetTree< Key, Tree, Compare >::num_nodes.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::del(), Aleph::DynSetTree< Key, Tree, Compare >::empty(), and Aleph::DynSetTree< Key, Tree, Compare >::remove_pos().
|
inline |
Removes a key from the dynamic set.
remove(key) finds the key in the set and removes it.
| [in] | key | key to delete |
Definition at line 1006 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::connect_arc(), demonstrate_basic_operations(), Aleph::dsatur_coloring(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::BruteForceConvexHull::operator()(), Aleph::CuttingEarsTriangulation::operator()(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), Aleph::Net_Graph< NodeT, ArcT >::register_node(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::remove_arc(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::remove_from_graph(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::remove_from_graph(), Aleph::DynMapTree< Key, Data, Tree, Compare >::remove_key(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), Aleph::GeomBowyerWatsonUtils::toggle_edge(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::update_parity_after_arc_insertion(), and Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::update_parity_after_arc_insertion().
|
inline |
Removes the key at the inorder position i.
| [in] | i | the inorder position of the key to remove. |
| std::domain_error | if the tree has no removal by position. |
| std::out_of_range | if i is not less than size(). |
| anything | that the copy of the stored key throws; the key leaves the set anyway, so that size() counts the keys that remain. |
Definition at line 1049 of file tpl_dynSetTree.H.
References ah_domain_error_if_constexpr, ah_logic_error_if, ah_out_of_range_error_if, Aleph::DynSetTree< Key, Tree, Compare >::call_remove_pos(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, Aleph::DynSetTree< Key, Tree, Compare >::release(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::BruteForceConvexHull::operator()(), Aleph::CuttingEarsTriangulation::operator()(), TEST(), TEST(), and TEST().
|
inline |
Find an element in the set.
search(key) searches for the key key in the set. If he element is found in the set, then a pointer to the value contained in the set; otherwise nullptr is returned.
| [in] | key | key to search for. |
Definition at line 1162 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::MonotonePolygonTriangulation::build_faces_from_diagonals(), Aleph::SweepLineSegmentIntersection::check_and_enqueue(), demonstrate_basic_operations(), demonstrate_tree_types(), Aleph::DynSetTree< Key, Tree, Compare >::exist(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::Init_P< GT >::operator()(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::search(), Aleph::DynMapTree< Key, Data, Tree, Compare >::search_pair(), Aleph::graph_coloring_detail::smallest_available(), test_DynSet(), Aleph::GeomBowyerWatsonUtils::toggle_edge(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::update_parity_after_arc_insertion(), and Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::verify_tables().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A pointer to const.
Definition at line 1172 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Look for the key in the binary search tree or inserts it if it is not found.
search_or_insert(key) searches the binary tree for a node whose key is KEY(p). If the key is finds, then a pointer to it is returned; of what Otherwise key is inserted into the binary tree of search this.
| [in] | key | the key to search or insert. |
Definition at line 926 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__search_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::alloc_node().
Referenced by Aleph::DynMapTree< Key, Data, Tree, Compare >::operator[](), Aleph::DynSetTree< Key, Tree, Compare >::operator[](), Aleph::DynMapTree< Key, Data, Tree, Compare >::operator[](), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search_or_insert_in_graph(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search_or_insert_in_graph(), TEST(), and TYPED_TEST().
|
inline |
Definition at line 931 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::__search_or_insert(), and Aleph::DynSetTree< Key, Tree, Compare >::alloc_node().
|
inline |
Returns the ith node in infix position.
| [in] | i | desired position |
Definition at line 1294 of file tpl_dynSetTree.H.
References ah_domain_error_if_constexpr, ah_logic_error_if, ah_out_of_range_error_if, Aleph::DynSetTree< Key, Tree, Compare >::call_select_nc(), Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::access(), demonstrate_ranked_operations(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_random_odd_nodes(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_a_node(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::make_eulerian(), Aleph::DynSetTree< Key, Tree, Compare >::operator()(), TEST(), TEST(), TEST(), and TEST().
|
inline |
|
inline |
Returns the cardinality of the set.
Definition at line 1210 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::num_nodes.
Referenced by Aleph::Two_Sat< GT >::add_at_most_one(), adjust_nodes(), count_distinct_colors(), demo_basic_operations(), demo_functional(), demo_tree_backends(), demo_word_frequency(), demonstrate_basic_operations(), demonstrate_ranked_operations(), Aleph::dsatur_coloring(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_random_odd_nodes(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_a_node(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::make_eulerian(), Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::min_cut(), Aleph::df_tree_detail::number_tree(), Aleph::DynMapTree< Key, Data, Tree, Compare >::remove_key(), Aleph::settree_to_Array(), Aleph::settree_to_vector(), AHDispatcher< Key, Operation >::size(), Aleph::AHMapping< Key, ValueType >::size(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test(), test_DynSet(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::verify_tables(), and Aleph::welsh_powell_coloring().
|
inline |
Partitions the binary search tree based on a key.
split_key(key,l,r) partitions, according to the key key, the binary search tree this in two trees l and r. After the operation the tree this becomes empty, l contains all keys less than key and r the major ones.
| [in] | key | partition key. |
| [out] | l | tree with keys less than key. |
| [out] | r | tree with keys greater than key. |
Definition at line 1594 of file tpl_dynSetTree.H.
References Aleph::compute_cardinality_rec(), l, Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, Aleph::DynSetTree< Key, Tree, Compare >::pin_arena(), r, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Partitions the binary search tree based on a key that may be present in the tree.
split_key_dup(key,l,r) partitions, according to key, the binary search tree this into two trees l and r. After the operation, tree this becomes empty, l contains all keys less than key and r contains keys greater than or equal to key.
| [in] | key | partition key. |
| [out] | l | tree with keys less than key. |
| [out] | r | tree with keys greater than or equal to key. |
Definition at line 1651 of file tpl_dynSetTree.H.
References Aleph::compute_cardinality_rec(), l, Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, Aleph::DynSetTree< Key, Tree, Compare >::pin_arena(), r, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inline |
Partitions the binary search tree based on an infix position.
split_pos(pos,l,r) partitions the binary search tree this into two trees l and r. After the operation, tree this becomes empty, l contains the first pos+1 keys and r the remaining ones.
| [in] | pos | partition position |
| [out] | l | tree with keys in interval [0,pos] |
| [out] | r | tree with keys in interval (pos,N), where N is the number of keys |
Definition at line 1620 of file tpl_dynSetTree.H.
References ah_domain_error_if_constexpr, ah_out_of_range_error_if, Aleph::DynSetTree< Key, Tree, Compare >::call_split_pos(), Aleph::compute_cardinality_rec(), l, Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, Aleph::DynSetTree< Key, Tree, Compare >::pin_arena(), r, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inlinenoexcept |
Exchange all elements of this set with dset in constant time (and extremely fast).
| [in] | dset | the set to exchange with this |
Definition at line 545 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator, Aleph::DynSetTree< Key, Tree, Compare >::num_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::DynSetTree(), Aleph::compute_min_cut(), Aleph::Huffman_Encoder_Engine::generate_huffman_tree(), Aleph::DynSetTree< Key, Tree, Compare >::operator=(), Aleph::DynSetTree< Key, Tree, Compare >::operator=(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::swap(), and Aleph::Net_Graph< NodeT, ArcT >::swap_contents().
|
inline |
See traverse(Operation & op).
Definition at line 1723 of file tpl_dynSetTree.H.
|
inline |
See traverse(Operation & op) const.
Definition at line 1748 of file tpl_dynSetTree.H.
|
inline |
Traverse all the set of pairs and for each key executes the operation op.
Operation must have the signature
If
returns false then the traversal is aborted; otherwise the routine advance and so on
| [in] | op | operation to execute for each key; it receives a modifiable reference. Modifying a key so that its order changes corrupts the tree. |
| anything | that op throws. |
Definition at line 1712 of file tpl_dynSetTree.H.
References Aleph::traverse(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by TYPED_TEST().
|
inline |
Traverse a constant set in order; each key is handed out as a constant reference.
| [in] | op | operation to execute for each key; it must accept const Key &. |
| anything | that op throws. |
Definition at line 1737 of file tpl_dynSetTree.H.
References Aleph::traverse(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
|
inlinenoexcept |
Returns true if the set is using an arena allocator.
Definition at line 1216 of file tpl_dynSetTree.H.
References Aleph::DynSetTree< Key, Tree, Compare >::arena_allocator.
|
inline |
Definition at line 1344 of file tpl_dynSetTree.H.
References FunctionalMethods< Container, T >::and, Aleph::check_bst(), and Aleph::DynSetTree< Key, Tree, Compare >::tree.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
private |
Definition at line 482 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::alloc_node(), Aleph::DynSetTree< Key, Tree, Compare >::alloc_node(), Aleph::DynSetTree< Key, Tree, Compare >::arena_allocated_size(), Aleph::DynSetTree< Key, Tree, Compare >::arena_available_size(), Aleph::DynSetTree< Key, Tree, Compare >::empty(), Aleph::DynSetTree< Key, Tree, Compare >::free_node(), Aleph::DynSetTree< Key, Tree, Compare >::pin_arena(), Aleph::DynSetTree< Key, Tree, Compare >::swap(), and Aleph::DynSetTree< Key, Tree, Compare >::uses_arena().
|
staticconstexprprivate |
Definition at line 478 of file tpl_dynSetTree.H.
|
staticconstexprprivate |
Whether building an empty tree with a comparison built by default throws nothing.
The header nodes of the tree hold a key built by default, and it copies the comparison. A randomized tree allocates nothing: its generator of random numbers is inside it.
Definition at line 563 of file tpl_dynSetTree.H.
|
private |
Definition at line 481 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::DynSetTree(), Aleph::DynSetTree< Key, Tree, Compare >::__contains_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::__insert(), Aleph::DynSetTree< Key, Tree, Compare >::__insert_dup(), Aleph::DynSetTree< Key, Tree, Compare >::__search_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::empty(), Aleph::DynSetTree< Key, Tree, Compare >::find_position(), Aleph::DynSetTree< Key, Tree, Compare >::get_root(), Aleph::DynSetTree< Key, Tree, Compare >::is_empty(), Aleph::DynSetTree< Key, Tree, Compare >::join(), Aleph::DynSetTree< Key, Tree, Compare >::join_dup(), Aleph::DynSetTree< Key, Tree, Compare >::max(), Aleph::DynSetTree< Key, Tree, Compare >::min(), Aleph::DynSetTree< Key, Tree, Compare >::release(), Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::DynSetTree< Key, Tree, Compare >::remove_pos(), Aleph::DynSetTree< Key, Tree, Compare >::select(), Aleph::DynSetTree< Key, Tree, Compare >::select(), Aleph::DynSetTree< Key, Tree, Compare >::size(), Aleph::DynSetTree< Key, Tree, Compare >::split_key(), Aleph::DynSetTree< Key, Tree, Compare >::split_key_dup(), Aleph::DynSetTree< Key, Tree, Compare >::split_pos(), and Aleph::DynSetTree< Key, Tree, Compare >::swap().
|
mutableprivate |
Definition at line 480 of file tpl_dynSetTree.H.
Referenced by Aleph::DynSetTree< Key, Tree, Compare >::DynSetTree(), Aleph::DynSetTree< Key, Tree, Compare >::__contains_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::__insert(), Aleph::DynSetTree< Key, Tree, Compare >::__insert_dup(), Aleph::DynSetTree< Key, Tree, Compare >::__search_or_insert(), Aleph::DynSetTree< Key, Tree, Compare >::del(), Aleph::DynSetTree< Key, Tree, Compare >::empty(), Aleph::DynSetTree< Key, Tree, Compare >::find(), Aleph::DynSetTree< Key, Tree, Compare >::find(), Aleph::DynSetTree< Key, Tree, Compare >::find_position(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_in_preorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_inorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_postorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_preorder(), Aleph::DynSetTree< Key, Tree, Compare >::get_compare(), Aleph::DynSetTree< Key, Tree, Compare >::get_root(), Aleph::DynSetTree< Key, Tree, Compare >::get_root_node(), Aleph::DynSetTree< Key, Tree, Compare >::height(), Aleph::DynSetTree< Key, Tree, Compare >::internal_path_length(), Aleph::DynSetTree< Key, Tree, Compare >::join(), Aleph::DynSetTree< Key, Tree, Compare >::join_dup(), Aleph::DynSetTree< Key, Tree, Compare >::key_comp(), Aleph::DynSetTree< Key, Tree, Compare >::max(), Aleph::DynSetTree< Key, Tree, Compare >::min(), Aleph::DynSetTree< Key, Tree, Compare >::position(), Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::DynSetTree< Key, Tree, Compare >::remove_pos(), Aleph::DynSetTree< Key, Tree, Compare >::search(), Aleph::DynSetTree< Key, Tree, Compare >::search(), Aleph::DynSetTree< Key, Tree, Compare >::select(), Aleph::DynSetTree< Key, Tree, Compare >::select(), Aleph::DynSetTree< Key, Tree, Compare >::split_key(), Aleph::DynSetTree< Key, Tree, Compare >::split_key_dup(), Aleph::DynSetTree< Key, Tree, Compare >::split_pos(), Aleph::DynSetTree< Key, Tree, Compare >::swap(), Aleph::DynSetTree< Key, Tree, Compare >::traverse(), Aleph::DynSetTree< Key, Tree, Compare >::traverse(), and Aleph::DynSetTree< Key, Tree, Compare >::verify().