171 if ( virtual_node ) {
173 if ( parents.size ( ) ) {
180 virtual_node =
false;
183 virtual_node =
false;
187 if ( !
node->getChildren ( ).empty ( ) ) {
188 parents.push_back (
node );
189 node = & *
node->getChildren ( ).begin ( );
222 }
else if ( virtual_node ) {
223 if ( !
node->getChildren ( ).empty ( ) ) {
224 parents.push_back (
node );
225 node = & * --
node->getChildren ( ).end ( );
227 virtual_node =
false;
230 if ( parents.size ( ) ) {
268 return node == other.node && virtual_node == other.virtual_node;
280 return !( *
this == other );
290 return node->getData ( );
300 return &
node->getData ( );
310 return parents.size ( );
363 while ( ( ++
node ).getVirtual ( ) );
388 while ( ( --
node ).getVirtual ( ) );
415 return node == other.node;
427 return !( *
this == other );
447 return &
node->getData ( );
457 return node.getLevel ( );
500 while ( !( ++
node ).getVirtual ( ) && !
node.isEnd );
525 while ( !( --
node ).getVirtual ( ) );
552 return node == other.node;
564 return !( *
this == other );
584 return &
node->getData ( );
594 return node.getLevel ( );
615 template <
typename Iterator >
638 return children.
insert ( position, std::move ( value ) );
682 template <
class Iterator >
686 return insert ( position, children.cbegin ( ), children.cend ( ) );
720 template <
typename ... Types >
733 template <
typename ... Types >
745 template <
typename Iterator >
769 return m_children.
begin ( );
779 return m_children.
begin ( );
789 return m_children.
end ( );
799 return m_children.
end ( );
823 res.node.isEnd =
true;
838 while ( !
res.node.getVirtual ( ) ) ++
res.node;
852 res.node.isEnd =
true;
892 children.push_back ( std::move ( value ) );
936 return children.
erase ( position );
951 template <
class ... Indexes >
953 return this->
operator ()( {
static_cast < size_t > ( indexes ) ... } );
967 for (
size_t index :
indexes ) {
968 node = &
node->getChildren ( )[index];
971 return node->getData ( );
984 template <
class ... Indexes >
986 return this->
operator ()( {
static_cast < size_t > ( indexes ) ... } );
1000 for (
size_t index :
indexes ) {
1001 node = &
node->getChildren ( )[index];
1004 return node->getData ( );
1020 swap ( first.m_children,
second.m_children );
1101 void nicePrint ( std::ostream & os, std::string prefix,
bool last )
const {
1112 os <<
getData ( ) << std::endl;
1114 for (
size_t i = 0;
i < m_children.size ( ); ++
i ) {
1115 os << prefix <<
"|" << std::endl;
1116 m_children[
i].nicePrint ( os, prefix,
i == m_children.size ( ) - 1 );
1139 while ( iter.getLevel ( ) > level ) {
1144 out << level << * iter;
1147 bool printComma = iter.getLevel ( ) == level;
1149 while ( iter.getLevel ( ) < level ) {
1155 if ( printComma && ( level != 0 ) )
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
The iterator type over structure of the tree following postorder traversal.
Definition: forward_tree.hpp:470
const T & reference
Definition: forward_tree.hpp:481
bool operator!=(const const_postfix_iterator &other) const
Compare the iterators for nonequality.
Definition: forward_tree.hpp:563
const T * pointer
Definition: forward_tree.hpp:480
bool operator==(const const_postfix_iterator &other) const
Compare the iterators for equality.
Definition: forward_tree.hpp:551
const T & operator*() const
Dereference the iterator by accessing the pointed node value.
Definition: forward_tree.hpp:573
std::ptrdiff_t difference_type
Definition: forward_tree.hpp:478
const_postfix_iterator(const forward_tree *n)
Constructor of the iterator based on the iterator to child list.
Definition: forward_tree.hpp:490
T value_type
Definition: forward_tree.hpp:479
const T * operator->() const
Dereference the iterator by accessing the pointed node value.
Definition: forward_tree.hpp:583
const_postfix_iterator & operator--()
Retract the iterator.
Definition: forward_tree.hpp:524
const_postfix_iterator & operator++()
Advances the iterator.
Definition: forward_tree.hpp:499
size_t getLevel() const
Retrieves what is the depth of node the iterator is pointing to.
Definition: forward_tree.hpp:593
std::bidirectional_iterator_tag iterator_category
Definition: forward_tree.hpp:482
The iterator type over structure of the tree following preorder traversal.
Definition: forward_tree.hpp:333
const T & reference
Definition: forward_tree.hpp:344
T value_type
Definition: forward_tree.hpp:342
const_prefix_iterator & operator++()
Advance the iterator.
Definition: forward_tree.hpp:362
const T * operator->() const
Dereference the iterator by accessing the pointed node value.
Definition: forward_tree.hpp:446
const_prefix_iterator(const forward_tree *n)
Constructor of the iterator based on the iterator to child list.
Definition: forward_tree.hpp:353
size_t getLevel() const
Retrieves what is the depth of node the iterator is pointing to.
Definition: forward_tree.hpp:456
const_prefix_iterator & operator--()
Retract the iterator.
Definition: forward_tree.hpp:387
std::bidirectional_iterator_tag iterator_category
Definition: forward_tree.hpp:345
bool operator==(const const_prefix_iterator &other) const
Compare the iterators for equality.
Definition: forward_tree.hpp:414
std::ptrdiff_t difference_type
Definition: forward_tree.hpp:341
const T & operator*() const
Dereference the iterator by accessing the pointed node value.
Definition: forward_tree.hpp:436
const T * pointer
Definition: forward_tree.hpp:343
bool operator!=(const const_prefix_iterator &other) const
Compare the iterators for nonequality.
Definition: forward_tree.hpp:426
The iterator type over structure of the tree representing nodes and node_ends.
Definition: forward_tree.hpp:123
std::bidirectional_iterator_tag iterator_category
Definition: forward_tree.hpp:153
const_structure_iterator & operator++()
Advance the iterator.
Definition: forward_tree.hpp:170
T value_type
Definition: forward_tree.hpp:150
const_structure_iterator(const forward_tree *n)
Constructor of the iterator based on the iterator to child list.
Definition: forward_tree.hpp:161
bool operator==(const const_structure_iterator &other) const
Compare the iterators for equality.
Definition: forward_tree.hpp:267
const T * operator->() const
Dereference the iterator by accessing the pointed node value.
Definition: forward_tree.hpp:299
std::ptrdiff_t difference_type
Definition: forward_tree.hpp:149
size_t getLevel() const
Retrieves what is the depth of node the iterator is pointing to.
Definition: forward_tree.hpp:309
const_structure_iterator & operator--()
Retract the iterator.
Definition: forward_tree.hpp:217
bool getVirtual() const
Allows to distinguish entry or leave visit of a pointed to node.
Definition: forward_tree.hpp:319
const T & reference
Definition: forward_tree.hpp:152
bool operator!=(const const_structure_iterator &other) const
Compare the iterators for nonequality.
Definition: forward_tree.hpp:279
const T & operator*() const
Dereference the iterator by accessing the pointed node value.
Definition: forward_tree.hpp:289
const T * pointer
Definition: forward_tree.hpp:151
Class introducing a forward_tree with interface trying to be close to the interface of standard libra...
Definition: forward_tree.hpp:49
forward_tree(T &&data, ext::vector< forward_tree > &&children)
Constructor of the forward_tree from value to be stored in the root node and children trees.
Definition: forward_tree.hpp:698
auto operator<=>(const forward_tree &other) const
Less comparison operator.
Definition: forward_tree.hpp:1045
ext::vector< forward_tree >::const_iterator const_children_iterator
The iterator type over children of the node.
Definition: forward_tree.hpp:109
const ext::vector< forward_tree > & getChildren() const
Getter of children of the root node.
Definition: forward_tree.hpp:101
void push_back(const ext::forward_tree< T > &value)
Pushbacks a subtree after last child of a tree.
Definition: forward_tree.hpp:901
children_iterator erase(const_children_iterator position)
Erases a subtree from a tree on given by position.
Definition: forward_tree.hpp:933
const_children_iterator begin() const
Getter of a children iterator to the begining of children.
Definition: forward_tree.hpp:768
forward_tree(const T &data, Iterator begin, Iterator end)
Constructor of the forward_tree from value to be stored in the root node and range of values to const...
Definition: forward_tree.hpp:746
const_postfix_iterator postfix_end() const
Getter of the postfix iterator one after the last node in the postfix traversal.
Definition: forward_tree.hpp:849
std::ostream & nicePrint(std::ostream &os) const
Internal method of printing a tree into a stream.
Definition: forward_tree.hpp:1073
children_iterator end()
Getter of a children iterator one after the last child.
Definition: forward_tree.hpp:798
const_children_iterator insert(const_children_iterator position, const_children_iterator begin, const_children_iterator end)
Insert helper for insertion specified by position in children and inserted subtrees given by range of...
Definition: forward_tree.hpp:664
const T & getData() const
Getter of the value in the root node.
Definition: forward_tree.hpp:81
forward_tree(const T &data, const ext::vector< forward_tree > &subtrees)
Constructor of the forward_tree from value to be stored in the root node and children trees.
Definition: forward_tree.hpp:708
const_children_iterator insert(const_children_iterator position, Iterator begin, Iterator end)
Inserts a subtrees into a forward_tree. The subtrees are nullary nodes having value given by values i...
Definition: forward_tree.hpp:683
void push_back(T &&value)
Pushbacks a nullary node after last child of a tree.
Definition: forward_tree.hpp:911
const T & operator()(Indexes ... indexes) const
Access value given indexes of chindren allong the selection path.
Definition: forward_tree.hpp:952
const_children_iterator insert(const_children_iterator position, const forward_tree< T > &value)
Inserts a subtree into a forward_tree.
Definition: forward_tree.hpp:650
void push_back(const T &value)
Pushbacks a nullary node after last child of a tree.
Definition: forward_tree.hpp:921
forward_tree(T &&data, Types ... subtrees)
Constructor of the forward_tree from value to be stored in the root node and pack of children trees.
Definition: forward_tree.hpp:734
T & getData()
Getter of the value in the root node.
Definition: forward_tree.hpp:71
children_iterator begin()
Getter of a children iterator to the begining of children.
Definition: forward_tree.hpp:778
friend void swap(forward_tree &first, forward_tree &second)
Swap method of two forward trees.
Definition: forward_tree.hpp:1016
forward_tree(const T &data, Types ... subtrees)
Constructor of the forward_tree from value to be stored in the root node and pack of children trees.
Definition: forward_tree.hpp:721
const_children_iterator insert(const_children_iterator position, forward_tree< T > &&value)
Inserts a subtree into a forward_tree.
Definition: forward_tree.hpp:635
const_structure_iterator structure_end() const
Getter of the structure iterator to one after the last node in the traversal.
Definition: forward_tree.hpp:874
forward_tree(const T &data, const_children_iterator begin, const_children_iterator end)
Constructor of the forward_tree from value to be stored in the root node and range of subtrees.
Definition: forward_tree.hpp:757
const_postfix_iterator postfix_begin() const
Getter of the postfix iterator to the first node in the postfix traversal.
Definition: forward_tree.hpp:835
const_structure_iterator structure_begin() const
Getter of the structure iterator to the first node in the traversal.
Definition: forward_tree.hpp:864
ext::vector< forward_tree > & getChildren()
Getter of children of the root node.
Definition: forward_tree.hpp:91
void push_back(ext::forward_tree< T > &&value)
Pushbacks a subtree after last child of a tree.
Definition: forward_tree.hpp:889
bool operator==(const forward_tree &other) const
Equality comparison operator.
Definition: forward_tree.hpp:1033
ext::vector< forward_tree >::iterator children_iterator
The iterator type over children of the node.
Definition: forward_tree.hpp:115
const_prefix_iterator prefix_begin() const
Getter of the prefix iterator to the root node.
Definition: forward_tree.hpp:810
const_prefix_iterator prefix_end() const
Getter of the prefix iterator one after the last node in the prefix traversal.
Definition: forward_tree.hpp:820
const_children_iterator end() const
Getter of a children iterator one after the last child.
Definition: forward_tree.hpp:788
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: vector.hpp:125
iterator erase(iterator pos)
Removes element from the container at position given by parameter pos.
Definition: vector.hpp:323
typename std::vector< T, Alloc >::iterator iterator
The type of values iterator.
Definition: vector.hpp:61
typename std::vector< T, Alloc >::const_iterator const_iterator
The type of constant values iterator.
Definition: vector.hpp:67
reverse_iterator insert(const_reverse_iterator pos, const T &value)
Inserts the value on position given by iterator pos.
Definition: vector.hpp:229
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
p second
Definition: ToRegExpAlgebraic.h:126
int i
Definition: AllEpsilonClosure.h:118
return res
Definition: MinimizeByPartitioning.h:145
Definition: sigHandler.cpp:20
std::ostream & operator<<(ext::reference_wrapper< std::ostream > &os, std::ostream &(*const func)(std::ostream &))
Overloaded function allowing same operations on wrapped output stream as on the actual output stream,...
Definition: GlobalData.cpp:33
Definition: CompressedBitParallelTreeIndex.h:40
Definition: FordFulkerson.hpp:16
void swap(ext::managed_linear_set< T, Compare, Alloc > &x, ext::managed_linear_set< T, Compare, Alloc > &y)
Specialisation of swap for linear set.
Definition: managed_linear_set.hpp:864