Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
tree.hpp
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include <memory>
27#include <string>
28#include <compare>
29#include <tuple>
30
31#include <ext/ostream>
32#include <ext/vector>
33
35
36#include <version>
37#ifndef __cpp_lib_three_way_comparison
38#include <extensions/compare.hpp>
39#endif
40
41namespace ext {
42
51template < class T >
52class tree {
57 T m_data;
58
63 tree * m_parent;
64
71 ext::vector < tree > m_children;
72
73public:
81 return m_parent;
82 }
83
90 const tree * getParent ( ) const {
91 return m_parent;
92 }
93
100 T & getData ( ) {
101 return m_data;
102 }
103
110 const T & getData ( ) const {
111 return m_data;
112 }
113
121 return m_children;
122 }
123
131 return m_children;
132 }
133
139
145
157 const tree * node;
158
163 size_t level;
164
169 bool virtual_node;
170
175 bool isEnd;
176
177 public:
178 using difference_type = std::ptrdiff_t;
179 using value_type = T;
180 using pointer = const T*;
181 using reference = const T&;
182 using iterator_category = std::bidirectional_iterator_tag;
183
190 const_structure_iterator ( const tree * n ) : node ( n ), level ( 0 ), virtual_node ( false ), isEnd ( false ) {
191 }
192
200 if ( virtual_node ) {
201 const tree * parent = node->getParent ( );
202 ++node;
203
204 if ( parent != nullptr ) {
205 if ( std::distance ( & * parent->getChildren ( ).begin ( ), node ) == std::distance ( parent->getChildren ( ).begin ( ), parent->getChildren ( ).end ( ) ) ) { // just a way to detect node == end_of_children
206 --level;
207 node = parent;
208 } else {
209 virtual_node = false;
210 }
211 } else {
212 virtual_node = false;
213 isEnd = true;
214 }
215 } else {
216 if ( ! node->getChildren ( ).empty ( ) ) {
217 ++level;
218 node = & * node->getChildren ( ).begin ( );
219 } else {
220 virtual_node = true;
221 }
222 }
223
224 return * this;
225 }
226
234 const_structure_iterator tmp ( * this );
235
236 operator ++( );
237 return tmp;
238 }
239
247 if ( isEnd ) {
248 --node;
249 virtual_node = true;
250 isEnd = false;
251 } else if ( virtual_node ) {
252 if ( ! node->getChildren ( ).empty ( ) ) {
253 ++level;
254
255 node = & * -- node->getChildren ( ).end ( );
256 } else {
257 virtual_node = false;
258 }
259 } else {
260 const tree * parent = node->getParent ( );
261
262 if ( parent != nullptr ) {
263 if ( node == & * parent->getChildren ( ).begin ( ) ) {
264 --level;
265 node = parent;
266 } else {
267 --node;
268 virtual_node = true;
269 }
270 }
271 }
272
273 return * this;
274 }
275
283 const_structure_iterator tmp ( * this );
284
285 operator --( );
286 return tmp;
287 }
288
297 bool operator ==( const const_structure_iterator & other ) const {
298 return node == other.node && virtual_node == other.virtual_node;
299 }
300
309 bool operator !=( const const_structure_iterator & other ) const {
310 return !( * this == other );
311 }
312
319 const T & operator *( ) const {
320 return node->getData ( );
321 }
322
329 const T * operator ->( ) const {
330 return & node->getData ( );
331 }
332
339 size_t getLevel ( ) const {
340 return level;
341 }
342
349 bool getVirtual ( ) const {
350 return virtual_node;
351 }
352
353 template < class F >
354 friend class tree;
355 };
356
369
370 public:
371 using difference_type = std::ptrdiff_t;
372 using value_type = T;
373 using pointer = const T*;
374 using reference = const T&;
375 using iterator_category = std::bidirectional_iterator_tag;
376
383 const_prefix_iterator ( const tree * n ) : node ( n ) {
384 }
385
393 while ( ( ++node ).getVirtual ( ) );
394
395 return * this;
396 }
397
405 const_prefix_iterator tmp ( * this );
406
407 operator ++( );
408 return tmp;
409 }
410
418 while ( ( --node ).getVirtual ( ) );
419
420 return * this;
421 }
422
430 const_prefix_iterator tmp ( * this );
431
432 operator --( );
433 return tmp;
434 }
435
444 bool operator ==( const const_prefix_iterator & other ) const {
445 return node == other.node;
446 }
447
456 bool operator !=( const const_prefix_iterator & other ) const {
457 return !( * this == other );
458 }
459
466 const T & operator *( ) const {
467 return * node;
468 }
469
476 const T * operator ->( ) const {
477 return & node->getData ( );
478 }
479
486 size_t getLevel ( ) const {
487 return node.getLevel ( );
488 }
489
490 template < class F >
491 friend class tree;
492 };
493
506
507 public:
508 using difference_type = std::ptrdiff_t;
509 using value_type = T;
510 using pointer = const T*;
511 using reference = const T&;
512 using iterator_category = std::bidirectional_iterator_tag;
513
520 const_postfix_iterator ( const tree * n ) : node ( n ) {
521 }
522
530 while ( !( ++node ).getVirtual ( ) && !node.isEnd );
531
532 return * this;
533 }
534
542 const_postfix_iterator tmp ( * this );
543
544 operator ++( );
545 return tmp;
546 }
547
555 while ( !( --node ).getVirtual ( ) );
556
557 return * this;
558 }
559
567 const_postfix_iterator tmp ( * this );
568
569 operator --( );
570 return tmp;
571 }
572
581 bool operator ==( const const_postfix_iterator & other ) const {
582 return node == other.node;
583 }
584
593 bool operator !=( const const_postfix_iterator & other ) const {
594 return !( * this == other );
595 }
596
603 const T & operator *( ) const {
604 return * node;
605 }
606
613 const T * operator ->( ) const {
614 return & node->getData ( );
615 }
616
623 size_t getLevel ( ) const {
624 return node.getLevel ( );
625 }
626
627 template < class F >
628 friend class tree;
629 };
630
631// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
632
633private:
645 template < class Iterator >
646 ext::vector < tree > fromIterator ( Iterator begin, Iterator end ) {
648
649 for ( ; begin != end; ++begin )
650 res.push_back ( tree ( * begin, { } ) );
651
652 return res;
653 }
654
655public:
666 value.m_parent = this;
667 return m_children.insert ( position, std::move ( value ) );
668 }
669
680 return insert ( position, tree < T > ( value ) );
681 }
682
694 typename ext::vector < tree >::iterator iter = m_children.insert ( position, begin, end );
695
696 for ( typename ext::vector < tree >::iterator iterCopy = iter; begin != end; ++begin, ++iterCopy )
697 iterCopy->m_parent = this;
698
699 return iter;
700 }
701
714 template < class Iterator >
716 ext::vector < tree > children = fromIterator ( begin, end );
717
718 return insert ( position, children.cbegin ( ), children.cend ( ) );
719 }
720
721// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
722
723public:
731 tree ( T && data, ext::vector < tree > && children ) : m_data ( std::move ( data ) ), m_parent ( nullptr ), m_children ( std::move ( children ) ) {
732 for ( tree & child : m_children )
733 child.m_parent = this;
734 }
735
743 tree ( const T & data, const ext::vector < tree > & subtrees ) : tree ( T ( data ), ext::vector < tree > ( subtrees ) ) {
744 }
745
755 template < typename ... Types >
756 tree ( const T & data, Types ... subtrees ) : tree ( data, ext::vector < tree > { subtrees ... } ) {
757 }
758
768 template < typename ... Types >
769 tree ( T && data, Types ... subtrees ) : tree ( std::move ( data ), ext::vector < tree > { subtrees ... } ) {
770 }
771
780 template < typename Iterator >
781 tree ( const T & data, Iterator begin, Iterator end ) : tree ( data, fromIterator ( begin, end ) ) {
782 }
783
793 }
794
799 ~tree ( ) noexcept = default;
800
807 tree ( const tree & other ) : m_data ( other.m_data ), m_parent ( other.m_parent ), m_children ( other.m_children ) {
808 for ( tree & child : m_children )
809 child.m_parent = this;
810 }
811
818 tree ( tree && other ) noexcept : m_data ( std::move ( other.m_data ) ), m_parent ( other.m_parent ), m_children ( std::move ( other.m_children ) ) {
819 for ( tree & child : m_children )
820 child.m_parent = this;
821 }
822
831 tree & operator =( const tree & node ) {
832 * this = tree ( node );
833 return * this;
834 }
835
844 tree & operator =( tree && node ) noexcept {
845 m_data = std::move ( node.m_data );
846 m_children = std::move ( node.m_children );
847
848 for ( tree & child : m_children )
849 child.m_parent = this;
850
851 return * this;
852 }
853
854// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
855
863 return m_children.begin ( );
864 }
865
873 return m_children.begin ( );
874 }
875
883 return m_children.end ( );
884 }
885
893 return m_children.end ( );
894 }
895
896// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
897
905 return const_prefix_iterator ( this );
906 }
907
915 const_prefix_iterator res ( this + 1 );
916
917 res.node.isEnd = true;
918 return res;
919 }
920
921// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
922
931
932 while ( ! res.node.getVirtual ( ) ) ++res.node;
933
934 return res;
935 }
936
944 const_postfix_iterator res ( this + 1 );
945
946 res.node.isEnd = true;
947 return res;
948 }
949
950// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
951
959 return const_structure_iterator ( this );
960 }
961
969 const_structure_iterator res ( this + 1 );
970
971 res.isEnd = true;
972 return res;
973 }
974
975// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
976
983 void push_back ( ext::tree < T > && value ) {
984 m_children.push_back ( std::move ( value ) );
985 m_children.back ( ).m_parent = this;
986 }
987
994 void push_back ( const ext::tree < T > & value ) {
995 push_back ( tree ( value ) );
996 }
997
1004 void push_back ( T && value ) {
1005 push_back ( tree ( std::move ( value ) ) );
1006 }
1007
1014 void push_back ( const T & value ) {
1015 push_back ( T ( value ) );
1016 }
1017
1018// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1019
1027 return m_children.erase ( position );
1028 }
1029
1030// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1031
1042 template < class ... Indexes >
1043 const T & operator ()( Indexes ... indexes ) const {
1044 return this->operator ()( { static_cast < size_t > ( indexes ) ... } );
1045 }
1046
1055 const T & operator ()( std::initializer_list < size_t > indexes ) const {
1056 const tree * node = this;
1057
1058 for ( size_t index : indexes ) {
1059 node = & node->getChildren ( )[index];
1060 }
1061
1062 return node->getData ( );
1063 }
1064
1075 template < class ... Indexes >
1076 T & operator ()( Indexes ... indexes ) {
1077 return this->operator ()( { static_cast < size_t > ( indexes ) ... } );
1078 }
1079
1088 T & operator ()( std::initializer_list < size_t > indexes ) {
1089 tree * node = this;
1090
1091 for ( size_t index : indexes ) {
1092 node = & node->getChildren ( )[index];
1093 }
1094
1095 return node->getData ( );
1096 }
1097
1098// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1099
1108 bool checkStructure ( const tree & node ) const {
1109 bool sign = true;
1110
1111 for ( const tree & child : node.getChildren ( ) )
1112 sign &= child.getParent ( ) == & node && checkStructure ( child );
1113
1114 return sign;
1115 }
1116
1125 bool checkStructure ( ) const {
1126 return m_parent == nullptr && checkStructure ( * this );
1127 }
1128
1129// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1130
1138 friend void swap ( tree & first, tree & second ) {
1139 using std::swap;
1140
1141 swap ( first.m_data, second.m_data );
1142 swap ( first.m_children, second.m_children );
1143 for ( tree & child : first.m_children )
1144 child.m_parent = & first;
1145 for ( tree & child : second.m_children )
1146 child.m_parent = & second;
1147 }
1148
1149// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1150
1159 bool operator ==( const tree & other ) const {
1160 return std::tie ( this->getData ( ), this->getChildren ( ) ) == std::tie ( other.getData ( ), other.getChildren ( ) );
1161 }
1162
1171 auto operator <=> ( const tree & other ) const -> decltype ( std::declval < T > ( ) <=> std::declval < T > ( ) ) {
1172 return std::tie ( this->getData ( ), this->getChildren ( ) ) <=> std::tie ( other.getData ( ), other.getChildren ( ) );
1173 }
1174
1175// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1176
1200 nicePrint ( os, "", true );
1201 return os;
1202 }
1203
1204private:
1227 void nicePrint ( ext::ostream & os, std::string prefix, const bool last ) const {
1228 os << prefix;
1229
1230 if ( last ) {
1231 os << "\\-";
1232 prefix += " ";
1233 } else {
1234 os << "|-";
1235 prefix += "| ";
1236 }
1237
1238 os << getData ( ) << std::endl;
1239
1240 for ( size_t i = 0; i < m_children.size ( ); ++i ) {
1241 os << prefix << "|" << std::endl;
1242 m_children[i].nicePrint ( os, prefix, i == m_children.size ( ) - 1 );
1243 }
1244 }
1245
1246};
1247
1259template < class T >
1261 out << "[";
1262
1263 size_t level = 0;
1264
1265 for ( typename tree < T >::const_prefix_iterator iter = t.prefix_begin ( ); iter != t.prefix_end ( ); ) {
1266 while ( iter.getLevel ( ) > level ) {
1267 out << "[";
1268 ++level;
1269 }
1270
1271 out << level << * iter;
1272 ++iter;
1273
1274 bool printComma = iter.getLevel ( ) == level;
1275
1276 while ( iter.getLevel ( ) < level ) {
1277 out << "]";
1278 --level;
1279 printComma = true;
1280 }
1281
1282 if ( printComma && ( level != 0 ) )
1283 out << ",";
1284 }
1285
1286 out << "]";
1287 return out;
1288}
1289
1290} /* namespace ext */
Definition: ostream.h:14
The iterator type over structure of the tree following postorder traversal.
Definition: tree.hpp:500
bool operator!=(const const_postfix_iterator &other) const
Compare the iterators for nonequality.
Definition: tree.hpp:593
T value_type
Definition: tree.hpp:509
const T * pointer
Definition: tree.hpp:510
const T * operator->() const
Dereference the iterator by accessing the pointed node value.
Definition: tree.hpp:613
std::ptrdiff_t difference_type
Definition: tree.hpp:508
bool operator==(const const_postfix_iterator &other) const
Compare the iterators for equality.
Definition: tree.hpp:581
const_postfix_iterator(const tree *n)
Constructor of the iterator based on the iterator to child list.
Definition: tree.hpp:520
std::bidirectional_iterator_tag iterator_category
Definition: tree.hpp:512
const_postfix_iterator & operator--()
Retract the iterator.
Definition: tree.hpp:554
const T & operator*() const
Dereference the iterator by accessing the pointed node value.
Definition: tree.hpp:603
const T & reference
Definition: tree.hpp:511
const_postfix_iterator & operator++()
Advances the iterator.
Definition: tree.hpp:529
size_t getLevel() const
Retrieves what is the depth of node the iterator is pointing to.
Definition: tree.hpp:623
The iterator type over structure of the tree following preorder traversal.
Definition: tree.hpp:363
size_t getLevel() const
Retrieves what is the depth of node the iterator is pointing to.
Definition: tree.hpp:486
const_prefix_iterator(const tree *n)
Constructor of the iterator based on the iterator to child list.
Definition: tree.hpp:383
const T * pointer
Definition: tree.hpp:373
bool operator==(const const_prefix_iterator &other) const
Compare the iterators for equality.
Definition: tree.hpp:444
T value_type
Definition: tree.hpp:372
bool operator!=(const const_prefix_iterator &other) const
Compare the iterators for nonequality.
Definition: tree.hpp:456
const_prefix_iterator & operator++()
Advance the iterator.
Definition: tree.hpp:392
const T & operator*() const
Dereference the iterator by accessing the pointed node value.
Definition: tree.hpp:466
std::bidirectional_iterator_tag iterator_category
Definition: tree.hpp:375
const_prefix_iterator & operator--()
Retract the iterator.
Definition: tree.hpp:417
std::ptrdiff_t difference_type
Definition: tree.hpp:371
const T * operator->() const
Dereference the iterator by accessing the pointed node value.
Definition: tree.hpp:476
const T & reference
Definition: tree.hpp:374
The iterator type over structure of the tree representing nodes and node_ends.
Definition: tree.hpp:152
const T * operator->() const
Dereference the iterator by accessing the pointed node value.
Definition: tree.hpp:329
const_structure_iterator & operator++()
Advance the iterator.
Definition: tree.hpp:199
bool operator==(const const_structure_iterator &other) const
Compare the iterators for equality.
Definition: tree.hpp:297
const_structure_iterator(const tree *n)
Constructor of the iterator based on the iterator to child list.
Definition: tree.hpp:190
const T & operator*() const
Dereference the iterator by accessing the pointed node value.
Definition: tree.hpp:319
bool getVirtual() const
Allows to distinguish entry or leave visit of a pointed to node.
Definition: tree.hpp:349
T value_type
Definition: tree.hpp:179
const_structure_iterator & operator--()
Retract the iterator.
Definition: tree.hpp:246
size_t getLevel() const
Retrieves what is the depth of node the iterator is pointing to.
Definition: tree.hpp:339
std::bidirectional_iterator_tag iterator_category
Definition: tree.hpp:182
bool operator!=(const const_structure_iterator &other) const
Compare the iterators for nonequality.
Definition: tree.hpp:309
const T * pointer
Definition: tree.hpp:180
const T & reference
Definition: tree.hpp:181
std::ptrdiff_t difference_type
Definition: tree.hpp:178
Class introducing a tree with interface trying to be close to the interface of standard library conta...
Definition: tree.hpp:52
children_iterator begin()
Getter of a children iterator to the begining of children.
Definition: tree.hpp:872
const_structure_iterator structure_end() const
Getter of the structure iterator to one after the last node in the traversal.
Definition: tree.hpp:968
children_iterator end()
Getter of a children iterator one after the last child.
Definition: tree.hpp:892
const_children_iterator insert(const_children_iterator position, const_children_iterator begin, const_children_iterator end)
Inserts subtrees given by range of values at specified position.
Definition: tree.hpp:693
const_postfix_iterator postfix_begin() const
Getter of the postfix iterator to the first node in the postfix traversal.
Definition: tree.hpp:929
const_children_iterator end() const
Getter of a children iterator one after the last child.
Definition: tree.hpp:882
void push_back(T &&value)
Pushbacks a nullary node after last child of a tree.
Definition: tree.hpp:1004
friend void swap(tree &first, tree &second)
Swap method of two trees.
Definition: tree.hpp:1138
const_children_iterator insert(const_children_iterator position, tree< T > &&value)
Inserts a subtree into a tree.
Definition: tree.hpp:665
const_children_iterator begin() const
Getter of a children iterator to the begining of children.
Definition: tree.hpp:862
const tree * getParent() const
Getter of the parent node. Null if the node is root.
Definition: tree.hpp:90
tree * getParent()
Getter of the parent node. Null if the node is root.
Definition: tree.hpp:80
const_prefix_iterator prefix_begin() const
Getter of the prefix iterator to the root node.
Definition: tree.hpp:904
bool checkStructure() const
Helper method to traverse the tree and check all parent references are set correctly....
Definition: tree.hpp:1125
children_iterator erase(const_children_iterator position)
Erases a subtree from a tree on given by position.
Definition: tree.hpp:1026
~tree() noexcept=default
Dectructor of the tree.
tree(const T &data, Iterator begin, Iterator end)
Constructor of the tree from value to be stored in the root node and range of values to construct nul...
Definition: tree.hpp:781
T & getData()
Getter of the value in the root node.
Definition: tree.hpp:100
void push_back(const T &value)
Pushbacks a nullary node after last child of a tree.
Definition: tree.hpp:1014
const T & getData() const
Getter of the value in the root node.
Definition: tree.hpp:110
void push_back(const ext::tree< T > &value)
Pushbacks a subtree after last child of a tree.
Definition: tree.hpp:994
tree(const T &data, const_children_iterator begin, const_children_iterator end)
Constructor of the tree from value to be stored in the root node and range of subtrees.
Definition: tree.hpp:792
const_children_iterator insert(const_children_iterator position, const tree< T > &value)
Inserts a subtree into a tree.
Definition: tree.hpp:679
bool checkStructure(const tree &node) const
Helper method to traverse the tree and check all parent references are set correctly.
Definition: tree.hpp:1108
tree(T &&data, ext::vector< tree > &&children)
Constructor of the tree from value to be stored in the root node and children trees.
Definition: tree.hpp:731
const_structure_iterator structure_begin() const
Getter of the structure iterator to the first node in the traversal.
Definition: tree.hpp:958
tree(const T &data, const ext::vector< tree > &subtrees)
Constructor of the tree from value to be stored in the root node and children trees.
Definition: tree.hpp:743
tree & operator=(const tree &node)
Copy operator of assignment of the tree.
Definition: tree.hpp:831
const T & operator()(Indexes ... indexes) const
Access value given indexes of chindren allong the selection path.
Definition: tree.hpp:1043
ext::ostream & nicePrint(ext::ostream &os) const
Method of printing a tree into a stream.
Definition: tree.hpp:1199
void push_back(ext::tree< T > &&value)
Pushbacks a subtree after last child of a tree.
Definition: tree.hpp:983
const_postfix_iterator postfix_end() const
Getter of the postfix iterator one after the last node in the postfix traversal.
Definition: tree.hpp:943
bool operator==(const tree &other) const
Equality comparison operator.
Definition: tree.hpp:1159
tree(const T &data, Types ... subtrees)
Constructor of the tree from value to be stored in the root node and pack of children trees.
Definition: tree.hpp:756
ext::vector< tree >::iterator children_iterator
The iterator type over children of the node.
Definition: tree.hpp:144
auto operator<=>(const tree &other) const -> decltype(std::declval< T >()<=> std::declval< T >())
Greater or equal comparison operator.
Definition: tree.hpp:1171
const_children_iterator insert(const_children_iterator position, Iterator begin, Iterator end)
Inserts a subtrees into a tree. The subtrees are nullary nodes having value given by values in the ra...
Definition: tree.hpp:715
ext::vector< tree >::const_iterator const_children_iterator
The iterator type over children of the node.
Definition: tree.hpp:138
tree(tree &&other) noexcept
Move constructor of the tree.
Definition: tree.hpp:818
const_prefix_iterator prefix_end() const
Getter of the prefix iterator one after the last node in the prefix traversal.
Definition: tree.hpp:914
ext::vector< tree > & getChildren()
Getter of children of the root node.
Definition: tree.hpp:120
const ext::vector< tree > & getChildren() const
Getter of children of the root node.
Definition: tree.hpp:130
tree(T &&data, Types ... subtrees)
Constructor of the tree from value to be stored in the root node and pack of children trees.
Definition: tree.hpp:769
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
constexpr tuple< Elements &... > tie(Elements &... args) noexcept
Helper of extended tuple of references construction. The tuple is constructed to reffer to values in ...
Definition: tuple.hpp:218
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: Node.cpp:11
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
Definition: BackwardOccurrenceTest.h:17