An object based trie used for parent-child hierarchies. More...
#include <ObjectTrie.hpp>
Classes | |
class | BreadthIterator |
A breadth first iterator for the trie. More... | |
class | ConstBreadthIterator |
A breadth first const iterator for the trie. More... | |
class | ConstDepthIterator |
A depth first const iterator for the trie. More... | |
class | DepthIterator |
A depth first iterator for the trie. More... | |
Public Types | |
using | const_iterator = ConstDepthIterator |
Default (depth first) const iterator. More... | |
using | iterator = DepthIterator |
Default (depth first) iterator. More... | |
Public Member Functions | |
ObjectTrie ()=default | |
Construct the trie with a root value equal to the default construction of T. More... | |
ObjectTrie (const T &trieRoot_) | |
Construct the trie by making a copy of the supplied root value. More... | |
ObjectTrie (T &&trieRoot_) | |
Construct the trie by moving the supplied root value. More... | |
ObjectTrie (const ObjectTrie< T > ©) | |
Create a trie by copying an existing trie. More... | |
ObjectTrie (ObjectTrie< T > &&rhs) noexcept | |
Move a trie. More... | |
template<typename ... ObjectAdderT> | |
ObjectTrieNode< T > & | add (T &&value, ObjectAdderT &&... childNode) |
Append a child containing the supplied data to the root node, plus children of the new child. More... | |
ObjectTrieNode< T > & | add (const T &value) |
Append a child containing a copy of the supplied data to the root node. More... | |
ObjectTrieNode< T > & | add (T &&value) |
Append a child containing the supplied data to the root node. More... | |
ObjectTrieNode< T > & | addAndReturnChild (const T &value) |
Append a root node child containing a copy of the supplied data. More... | |
ObjectTrieNode< T > & | addAndReturnChild (T &&value) |
Append a root node child containing a the supplied data. More... | |
ObjectTrieNode< T > & | addOrReplace (const T &value) |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it. More... | |
ObjectTrieNode< T > & | addOrReplace (T &&value) |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT > | |
ObjectTrieNode< T > & | addOrReplace (const T &value, CompareT compare) |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT > | |
ObjectTrieNode< T > & | addOrReplace (T &&value, CompareT compare) |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT , typename ReplaceT > | |
ObjectTrieNode< T > & | addOrReplace (const T &value, CompareT compare, ReplaceT replace) |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT , typename ReplaceT > | |
ObjectTrieNode< T > & | addOrReplace (T &&value, CompareT compare, ReplaceT replace) |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it. More... | |
ObjectTrieNode< T > & | addOrReplaceAndReturnChild (const T &value) |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it. More... | |
ObjectTrieNode< T > & | addOrReplaceAndReturnChild (T &&value) |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT > | |
ObjectTrieNode< T > & | addOrReplaceAndReturnChild (const T &value, CompareT compare) |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT > | |
ObjectTrieNode< T > & | addOrReplaceAndReturnChild (T &&value, CompareT compare) |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT , typename ReplaceT > | |
ObjectTrieNode< T > & | addOrReplaceAndReturnChild (const T &value, CompareT compare, ReplaceT replace) |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it. More... | |
template<typename CompareT , typename ReplaceT > | |
ObjectTrieNode< T > & | addOrReplaceAndReturnChild (T &&value, CompareT compare, ReplaceT replace) |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it. More... | |
DepthIterator | begin () |
Get a depth iterator positioned at the beginning of the trie. More... | |
ConstDepthIterator | begin () const |
Get a const depth iterator positioned at the beginning of the trie. More... | |
BreadthIterator | breadthBegin () |
Get a breadth iterator positioned at the beginning of the trie. More... | |
ConstBreadthIterator | breadthBegin () const |
Get a const breadth iterator positioned at the beginning of the trie. More... | |
BreadthIterator | breadthEnd () |
Get a breadth iterator positioned at the end of the trie. More... | |
ConstBreadthIterator | breadthEnd () const |
Get a const breadth iterator positioned at the end of the trie. More... | |
void | cascade (const ObjectTrie< T > &toCascade) |
Cascades the supplied trie onto this trie, copying the values. More... | |
void | cascade (ObjectTrie< T > &&toCascade) |
Cascades the supplied trie onto this trie, moving the source values. More... | |
template<typename U > | |
void | cascade (const ObjectTrie< T > &toCascade, U copyFunction) |
Cascades the supplied trie onto this trie. More... | |
template<typename U > | |
void | cascade (ObjectTrie< T > &&toCascade, U moveFunction) |
Cascades the supplied trie onto this trie. More... | |
size_t | count () const |
Get the number of children in the root node. More... | |
DepthIterator | depthBegin () |
Get a depth iterator positioned at the beginning of the trie. More... | |
ConstDepthIterator | depthBegin () const |
Get a const depth iterator positioned at the beginning of the trie. More... | |
DepthIterator | depthEnd () |
Get a depth iterator positioned at the end of the trie. More... | |
ConstDepthIterator | depthEnd () const |
Get a const depth iterator positioned at the end of the trie. More... | |
bool | empty () const |
Returns true if the trie is empty. More... | |
DepthIterator | end () |
Get a depth iterator positioned at the end of the trie. More... | |
ConstDepthIterator | end () const |
Get a const depth iterator positioned at the end of the trie. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
ObjectTrieNode< T > * | find (const ContainerT< U, UC ... > &values, bool skipRoot=true) |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
const ObjectTrieNode< T > * | find (const ContainerT< U, UC ... > &values, bool skipRoot=true) const |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
ObjectTrieNode< T > * | find (const ContainerT< U, UC ... > &values, CompareT compare, bool skipRoot=true) |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
const ObjectTrieNode< T > * | find (const ContainerT< U, UC ... > &values, CompareT compare, bool skipRoot=true) const |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
ObjectTrieNode< T > * | findNearest (const ContainerT< U, UC ... > &values, bool skipRoot=true) |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
const ObjectTrieNode< T > * | findNearest (const ContainerT< U, UC ... > &values, bool skipRoot=true) const |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
ObjectTrieNode< T > * | findNearest (const ContainerT< U, UC ... > &values, CompareT compare, bool skipRoot=true) |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
const ObjectTrieNode< T > * | findNearest (const ContainerT< U, UC ... > &values, CompareT compare, bool skipRoot=true) const |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
ObjectTrieNode< T > * | findNearestLeaf (const ContainerT< U, UC ... > &values, bool skipRoot=true) |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
const ObjectTrieNode< T > * | findNearestLeaf (const ContainerT< U, UC ... > &values, bool skipRoot=true) const |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
ObjectTrieNode< T > * | findNearestLeaf (const ContainerT< U, UC ... > &values, CompareT compare, bool skipRoot=true) |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
const ObjectTrieNode< T > * | findNearestLeaf (const ContainerT< U, UC ... > &values, CompareT compare, bool skipRoot=true) const |
Descend into the trie, locating matches of the supplied values. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC> | |
ObjectTrieNode< T > & | findOrAdd (const ContainerT< U, UC ... > &values) |
Descend into the trie, locating matches of the supplied values, or creating them if they do not exist. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT > | |
ObjectTrieNode< T > & | findOrAdd (const ContainerT< U, UC ... > &values, CompareT compare) |
Descend into the trie, locating matches of the supplied values, or creating them if they do not exist. More... | |
template<typename U , template< typename ... > class ContainerT, typename ... UC, typename CompareT , typename Create > | |
ObjectTrieNode< T > & | findOrAdd (const ContainerT< U, UC ... > &values, CompareT compare, Create create) |
Descend into the trie, locating matches of the supplied values, or creating them if they do not exist. More... | |
ObjectTrie< T > & | operator= (ObjectTrie< T > &&rhs) noexcept |
Move a trie to an existing trie. More... | |
ObjectTrie< T > & | operator= (const ObjectTrie< T > &rhs) |
Copy a trie to an existing trie. More... | |
ObjectTrieNode< T > & | operator[] (size_t index) |
Get a reference to the specified child in the root node. More... | |
const ObjectTrieNode< T > & | operator[] (size_t index) const |
Get a const reference to the specified child in the root node. More... | |
ObjectTrieNode< T > & | root () |
Get the root node of the trie. More... | |
const ObjectTrieNode< T > & | root () const |
Get the root node of the trie. More... | |
An object based trie used for parent-child hierarchies.
A node's children are ordered in the order of appending.
The trie has depth first and breadth first iterators.
The nodes of an object trie are single linked. If the ancestors of a node are required during iteration, the depth first iterator provides ancestor methods that access the iterator's internal node stack.
This data structure is useful when the parent-child relationships between nodes methods of instances are semantically important and must not be changed via tree balancing. If this is not the case, a B-tree or red–black tree would most likely be more appropriate.
The trie implementation is not optimised or compressed, thus use cases requiring the most optimised trie representation would most likely be better using a non-object based trie implementation.
An object of type T is contained in each trie node. Trie nodes also contain a heap based vector of child nodes.
When using the search algorithms of the object trie, the standard operator == function/method is used for the object type T. Alternative methods are also provided that accept a custom compare function/lambda.
The object type T should normally provide a key type field that is compared within the == operator, and one or more body fields that are not accessed by the object trie logic.
using const_iterator = ConstDepthIterator |
Default (depth first) const iterator.
For breadth first const iteration, use const_breadth_iterator.
using iterator = DepthIterator |
Default (depth first) iterator.
For breadth first iteration, use breadth_iterator.
|
default |
Construct the trie with a root value equal to the default construction of T.
|
inlineexplicit |
Construct the trie by making a copy of the supplied root value.
This constructor is used when the object type T does not have a default constructor and the supplied object will be copied.
|
inlineexplicit |
Construct the trie by moving the supplied root value.
This constructor is used when the object type T does not have a default constructor and the supplied object will be moved.
|
inline |
Create a trie by copying an existing trie.
|
inlinenoexcept |
Move a trie.
|
inline |
Append a child containing the supplied data to the root node, plus children of the new child.
|
inline |
Append a child containing a copy of the supplied data to the root node.
The data is copied into the new value.
|
inline |
Append a child containing the supplied data to the root node.
The data is moved into the new value.
|
inline |
Append a root node child containing a copy of the supplied data.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The data is copied into the new value.
|
inline |
Append a root node child containing a the supplied data.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The data is moved into the new value.
|
inline |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it.
The operator == method is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is copied into the new value.
|
inline |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it.
The operator == method is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is moved into the new value.
|
inline |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it.
The supplied comparator is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is copied into the new value.
|
inline |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it.
The supplied comparator is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is moved into the new value.
|
inline |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it.
The supplied comparator is used to compare values.
The supplied replacer is used to perform assignment of the values when a match is found.
The data is copied into the new value.
|
inline |
Append a child containing the supplied data to the root node if a child equal to the supplied value is not present, otherwise replace it.
The supplied comparator is used to compare values.
The supplied replacer is used to perform assignment of the values when a match is found.
The data is moved into the new value.
|
inline |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The operator == method is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is copied into the new value.
|
inline |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The operator == method is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is moved into the new value.
|
inline |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The supplied comparator is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is copied into the new value.
|
inline |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The supplied comparator is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is moved into the new value.
|
inline |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The supplied comparator is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is copied into the new value.
|
inline |
Append a root node child containing a copy of the supplied data if a child equal to the supplied value is not present, otherwise replace it.
This is an alternative form of the add() method, that returns the newly created child instead of the current node.
The supplied comparator is used to compare values.
The operator = method is used to assign the supplied value to the existing one when a matching value is is found.
The data is moved into the new value.
|
inline |
Get a depth iterator positioned at the beginning of the trie.
|
inline |
Get a const depth iterator positioned at the beginning of the trie.
|
inline |
Get a breadth iterator positioned at the beginning of the trie.
|
inline |
Get a const breadth iterator positioned at the beginning of the trie.
|
inline |
Get a breadth iterator positioned at the end of the trie.
|
inline |
Get a const breadth iterator positioned at the end of the trie.
|
inline |
Cascades the supplied trie onto this trie, copying the values.
In order that anything is cascaded, the values of the root nodes must match via the value type's operator ==, otherwise the result is a nop. It is the responsibility of the end developer to use a value type that has a suitable operator ==.
toCascade | the source trie |
|
inline |
Cascades the supplied trie onto this trie, moving the source values.
In order that anything is cascaded, the values of the root nodes must match via the value type's operator ==, otherwise the result is a nop. It is the responsibility of the end developer to use a value type that has a suitable operator ==.
By the end of this call, the source trie's values will be partially or fully emptied.
toCascade | the source trie |
|
inline |
Cascades the supplied trie onto this trie.
The values are copied via the supplied function.
In order that anything is cascaded, the values of the root nodes must match via the value type's operator ==, otherwise the result is a nop. It is the responsibility of the end developer to use a value type that has a suitable operator ==.
toCascade | the source trie |
moveFunction | the function used to copy the values |
|
inline |
Cascades the supplied trie onto this trie.
The values are moved via the supplied function. In order that anything is cascaded, the values of the root nodes must match via the value type's operator ==, otherwise the result is a nop. It is the responsibility of the end developer to use a value type that has a suitable operator ==.
By the end of this call, the source trie's values will be partially or fully emptied.
toCascade | the source trie |
moveFunction | the function used to move the values |
|
inline |
Get the number of children in the root node.
|
inline |
Get a depth iterator positioned at the beginning of the trie.
|
inline |
Get a const depth iterator positioned at the beginning of the trie.
|
inline |
Get a depth iterator positioned at the end of the trie.
|
inline |
Get a const depth iterator positioned at the end of the trie.
|
inline |
Returns true if the trie is empty.
|
inline |
Get a depth iterator positioned at the end of the trie.
|
inline |
Get a const depth iterator positioned at the end of the trie.
|
inline |
Descend into the trie, locating matches of the supplied values.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the exact node if all values were found or nullptr if not all values were matched.
values | a vector of values to search for |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the exact node if all values were found or nullptr if not all values were matched.
values | a vector of values to search for |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The supplied search vector contains values that are used in the custom compare function.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the exact node if all values were found or nullptr if not all values were matched.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The supplied search vector contains values that are used in the custom compare function.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the exact node if all values were found or nullptr if not all values were matched.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node or the exact node if all values were found.
Returns nullptr if no matching nodes were found.
values | a vector of values to search for |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node or the exact node if all values were found.
Returns nullptr if no matching nodes were found.
values | a vector of values to search for |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The supplied comparator is used to determine equality (true == equal).
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node or the exact node if all values were found.
Returns nullptr if no matching nodes were found.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The supplied comparator is used to determine equality (true == equal).
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node or the exact node if all values were found.
Returns nullptr if no matching nodes were found.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node if the node is a leaf node.
Returns nullptr if no matching leaf node was found.
values | a vector of values to search for |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node if the node is a leaf node.
Returns nullptr if no matching leaf node was found.
values | a vector of values to search for |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The supplied comparator is used to determine equality (true == equal).
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node if the node is a leaf node.
Returns nullptr if no matching leaf node was found.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values.
The supplied comparator is used to determine equality (true == equal).
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Returns the last matched node if the node is a leaf node.
Returns nullptr if no matching leaf node was found.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
skipRoot | does not check the first value against the root node of the trie |
|
inline |
Descend into the trie, locating matches of the supplied values, or creating them if they do not exist.
The default operator == compare function is used to determine equality.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Any nodes that are not found are created. Returns the node that was found or the created node if the node or one or more of its parent were not present.
As the root node of the trie is fixed, the findOrAdd algorithm never checks the first value against the root node of the trie, i.e. skipRoot is always true.
If the supplied values container is empty, the root node is returned.
values | a vector of values to search for |
|
inline |
Descend into the trie, locating matches of the supplied values, or creating them if they do not exist.
The supplied search vector contains values that are used in the custom compare function.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Any nodes that are not found are created. Returns the node that was found or the created node if the node or one or more of its parent were not present.
As the root node of the trie is fixed, the findOrAdd algorithm never checks the first value against the root node of the trie, i.e. skipRoot is always true.
If the supplied values container is empty, the root node is returned.
U | the type of the values used in the compare function |
CompareT | the compare function type |
values | a vector of values to search for |
compare | the compare function |
|
inline |
Descend into the trie, locating matches of the supplied values, or creating them if they do not exist.
The supplied search vector contains values that are used in the custom compare function.
The create function is used to create new nodes. The create function's argument is the current value as supplied in the values container.
Descends into the trie, locating at each node the first child that matches the next value in the supplied value chain. Any nodes that are not found are created. Returns the node that was found or the created node if the node or one or more of its parent were not present.
As the root node of the trie is fixed, the findOrAdd algorithm never checks the first value against the root node of the trie, i.e. skipRoot is always true.
If the supplied values container is empty, the root node is returned.
U | the type of the values used in the compare function |
CompareT | the compare function type |
Create | the function used to create new nodes |
values | a vector of values to search for |
compare | the compare function |
|
inlinenoexcept |
Move a trie to an existing trie.
|
inline |
Copy a trie to an existing trie.
|
inline |
Get a reference to the specified child in the root node.
|
inline |
Get a const reference to the specified child in the root node.
|
inline |
Get the root node of the trie.
|
inline |
Get the root node of the trie.