stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
stlab::forest< T > Class Template Reference

Hierarchical, node-based container: a forest (ordered sequence of trees) with fullorder iterators and child views. More...

#include <forest.hpp>

Public Types

using reference
using const_reference
using iterator
using const_iterator
using size_type
using difference_type
using value_type
using pointer
using const_pointer
using reverse_iterator
using const_reverse_iterator
using child_iterator
using const_child_iterator
using reverse_child_iterator
using preorder_iterator
using const_preorder_iterator
using postorder_iterator
using const_postorder_iterator

Public Member Functions

 forest (const forest &x)
 forest (forest &&x) noexcept
auto operator= (const forest &x) -> forest &
auto operator= (forest &&x) noexcept -> forest &
void swap (forest &x) noexcept
auto size () const -> size_type
 Returns the number of nodes; \(O(1)\) when size_valid() is true, otherwise a linear walk.
auto max_size () const -> size_type
auto size_valid () const -> bool
auto empty () const -> bool
auto root () -> iterator
auto root () const -> const_iterator
auto begin () -> iterator
auto end () -> iterator
auto begin () const -> const_iterator
auto end () const -> const_iterator
auto rbegin () -> reverse_iterator
auto rend () -> reverse_iterator
auto rbegin () const -> const_reverse_iterator
auto rend () const -> const_reverse_iterator
auto front () -> reference
auto front () const -> const_reference
auto back () -> reference
auto back () const -> const_reference
void clear ()
auto erase (const iterator &position) -> iterator
 Erases the node at position.
auto erase (const iterator &first, const iterator &last) -> iterator
 Erases every node in the half-open fullorder range [first, last).
auto insert (const iterator &position, T x) -> iterator
void push_front (const T &x)
void push_back (const T &x)
void pop_front ()
void pop_back ()
auto insert (iterator position, const const_child_iterator &first, const const_child_iterator &last) -> iterator
auto splice (const iterator &position, forest< T > &x) -> iterator
auto splice (const iterator &position, forest< T > &x, iterator i) -> iterator
auto splice (const iterator &position, forest< T > &x, child_iterator first, child_iterator last) -> iterator
auto splice (const iterator &position, forest< T > &x, const child_iterator &first, const child_iterator &last, size_type count) -> iterator
auto insert_parent (child_iterator front, child_iterator back, const T &x) -> iterator
void reverse (child_iterator first, child_iterator last)

Detailed Description

template<class T>
class stlab::forest< T >

Hierarchical, node-based container: a forest (ordered sequence of trees) with fullorder iterators and child views.

Values are stored in a tree threaded for bidirectional fullorder traversal (each node appears at a leading edge and again at a trailing edge). begin() / end() traverse that order; typedefs such as preorder_iterator and postorder_iterator select edge_iterator specializations. size() is \(O(1)\) when size_valid() is true; otherwise it walks the forest. Many mutating operations preserve the cached size; some splices can invalidate it on source and/or destination.

Erasing nodes
erase(position) removes that node. If it had children, those children become siblings inserted after the removed node’s former position (half-open erase(first, last) removes a contiguous fullorder range).

The documentation for this class was generated from the following file: