The binary tree structure, versioned via boost_version_Tree. More...
#include <binary_tree.h>
Public Types | |
typedef BinaryTree::Node< Value > | Node |
Type of nodes. More... | |
typedef Node * | Ptr |
Type of pointers to nodes. More... | |
typedef T | Value |
Type of values contained in the tree. More... | |
Public Member Functions | |
MemoryUsage::MemorySize | allocSize () const |
Returns the total size in bytes allocated for this tree. More... | |
Tree & | operator= (Tree &&other) |
Move assignment operator. More... | |
Tree & | operator= (Tree const &other) |
Copy assignment operator. More... | |
template<class Archive > | |
void | serialize (Archive &ar, unsigned int const in_version) |
Boost serialisation, recursive as usual. More... | |
Tree () | |
Default ctor with empty root node. More... | |
template<typename... Args> | |
Tree (Args... args) | |
Standard ctor. More... | |
Tree (Tree &&other) | |
Move ctor. More... | |
Tree (Tree const &other) | |
Copy ctor (deep-copies) More... | |
~Tree () | |
Dtor. More... | |
Node access functions | |
Node * | go_down (Node *ptr, Index steps) const |
Returns the steps -th child of *ptr , provided that there are no branches. More... | |
Node * | operator[] (std::string const &coordinate) const |
Returns a pointer to the node specified by coordinate . More... | |
Ptr | operator[] (std::array< Index, 2 > const &coordinate) const |
Returns a pointer to the node specified by the two-index coordinate. More... | |
Ptr | operator[] (std::initializer_list< Index > list) const |
Returns a pointer to the node specified by the two-index coordinate. More... | |
Ptr | last_fork (Ptr leaf) const |
Returns a pointer to the last fork on the way to the specified node. More... | |
Ptr | first_nonfork (Ptr leaf) const |
Returns a pointer to the first non-forking node in the non-forking branch that leads to leaf (i.e. one step further towards leaf than last_fork(leaf) More... | |
Ptr | leaf (Index const which) const |
Returns a pointer to the which -th leaf of the tree. More... | |
Visitors | |
template<typename Func > | |
std::result_of< Func(Ptr)>::type | visit_bottom (Func &&f, typename std::result_of< Func(Ptr)>::type initial, IterFirst const dir=IterFirst::Left) |
Visits each node, starting at the left or right bottommost node. More... | |
template<typename Func > | |
std::result_of< Func(constPtr)>::type | visit_bottom (Func &&f, typename std::result_of< Func(const Ptr)>::type initial, IterFirst const dir=IterFirst::Left) const |
Visits each node, starting at the left or right bottommost node for const trees. More... | |
template<typename Func > | |
void | visit_bottom (Func &&f, IterFirst const dir=IterFirst::Left) |
Visits each node, starting at the left or right bottommost node. More... | |
template<typename Func > | |
void | visit_bottom (Func &&f, IterFirst const dir=IterFirst::Left) const |
Visits each node, starting at the left or right bottommost node for const trees. More... | |
template<typename Func > | |
std::result_of< Func(Value &)>::type | visit_bottom (Func &&f, typename std::result_of< Func(Value &)>::type initial, IterFirst const dir=IterFirst::Left) |
Visits each node, starting at the left or right bottommost node. More... | |
template<typename Func > | |
std::result_of< Func(Valueconst &)>::type | visit_bottom (Func &&f, typename std::result_of< Func(Value const &)>::type initial, IterFirst const dir=IterFirst::Left) const |
Visits each node, starting at the left or right bottommost node for const trees. More... | |
template<typename Func > | |
std::result_of< Func(Ptr)>::type | visit_top (Func &&f, typename std::result_of< Func(Ptr)>::type initial, IterFirst const dir=IterFirst::Left) |
Visits each node, starting at the root node. More... | |
template<typename Func > | |
std::result_of< Func(constPtr)>::type | visit_top (Func &&f, typename std::result_of< Func(Ptr)>::type initial, IterFirst const dir=IterFirst::Left) const |
Visits each node, starting at the root node for const trees. More... | |
template<typename Func > | |
void | visit_top (Func &&f, IterFirst const dir=IterFirst::Left) |
Visits each node, starting at the root node. More... | |
template<typename Func > | |
void | visit_top (Func &&f, IterFirst const dir=IterFirst::Left) const |
Visits each node, starting at the root node, for const trees. More... | |
template<typename Func > | |
std::result_of< Func(Valueconst &)>::type | visit_top (Func &&f, typename std::result_of< Func(Value &)>::type initial, IterFirst const dir=IterFirst::Left) |
Visits each node, starting at the root node. More... | |
template<typename Func > | |
std::result_of< Func(Valueconst &)>::type | visit_top (Func &&f, typename std::result_of< Func(Value const &)>::type initial, IterFirst const dir=IterFirst::Left) const |
Visits each node, starting at the root node, for const trees. More... | |
Static Public Member Functions | |
Implementation for visitors | |
template<typename Func , typename PtrType > | |
static std::result_of< Func(Ptr)>::type | visit_bottom_rec (Func &&f, typename std::result_of< Func(PtrType)>::type initial, IterFirst const dir, PtrType ptr) |
Recursively visits a subtree, bottom-first. More... | |
template<typename Func , typename ValueType , typename PtrType > | |
static std::result_of< Func(ValueType &)>::type | visit_bottom_rec (Func &&f, typename std::result_of< Func(ValueType &)>::type initial, IterFirst const dir, PtrType ptr) |
Recursively visits a subtree, bottom-first. More... | |
template<typename Func , typename PtrType > | |
static void | visit_bottom_rec (Func &&f, IterFirst const dir, PtrType ptr) |
Recursively visits a subtree, bottom-first. More... | |
template<typename Func , typename PtrType > | |
static std::result_of< Func(PtrType)>::type | visit_top_rec (Func &&f, typename std::result_of< Func(PtrType)>::type initial, IterFirst const dir, PtrType ptr) |
Recursively visits a subtree, top-first for const trees. More... | |
template<typename Func , typename PtrType , typename ValueType > | |
static std::result_of< Func(ValueType &)>::type | visit_top_rec (Func &&f, typename std::result_of< Func(ValueType &)>::type initial, IterFirst const dir, PtrType ptr) |
Recursively visits a subtree, top-first. More... | |
template<typename Func , typename PtrType > | |
static void | visit_top_rec (Func &&f, IterFirst const dir, PtrType ptr) |
Recursively visits a subtree, top-first. More... | |
Public Attributes | |
Node * | r = nullptr |
Root node of the tree. More... | |
The binary tree structure, versioned via boost_version_Tree.