37#ifndef __ADS_ThreadedTree
38 #define __ADS_ThreadedTree
65template< std::totally_ordered K >
116 [[nodiscard]] std::size_t
size(
void )
const;
125 [[nodiscard]] std::vector< K >
reversed(
void )
const;
133 Node *left = nullptr ,
135 bool lthread = true ,
161 : f_t( t ) , f_x( x ) { }
169 f_x = f_t->successor( f_x );
174 f_x = f_t->predecessor( f_x );
191 return( f_x == o.f_x );
196 const Node * f_x =
nullptr;
237 [[nodiscard]]
const Node * successor(
const Node * x )
const;
241 [[nodiscard]]
const Node * predecessor(
const Node * x )
const;
244 [[nodiscard]]
bool threaded(
void )
const;
247 std::size_t f_size = 0;
259#include "ADS/tree/impl/ThreadedTree.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The iterators that the containers of the library have in common, beyond the book: they give a contain...
the constant iterator in symmetric order, by the threads
Definition ThreadedTree.h:147
std::bidirectional_iterator_tag iterator_category
the category of the iterator, bidirectional
Definition ThreadedTree.h:150
bool operator==(const const_iterator &o) const
equal on the same node
Definition ThreadedTree.h:190
const K & reference
a constant reference
Definition ThreadedTree.h:153
const_iterator & operator--(void)
to the predecessor, by predecessor()
Definition ThreadedTree.h:173
K value_type
the type of the keys
Definition ThreadedTree.h:151
const K * pointer
a constant pointer
Definition ThreadedTree.h:154
const_iterator(void)=default
an iterator on no tree
const_iterator operator++(int)
to the successor, returning the iterator before the step
Definition ThreadedTree.h:178
const_iterator & operator++(void)
to the successor, by successor()
Definition ThreadedTree.h:168
pointer operator->(void) const
the address of the key
Definition ThreadedTree.h:166
const_iterator operator--(int)
to the predecessor, returning the iterator before the step
Definition ThreadedTree.h:184
std::ptrdiff_t difference_type
the type of the distances
Definition ThreadedTree.h:152
reference operator*(void) const
the key
Definition ThreadedTree.h:164
const_iterator(const ThreadedTree *t, const Node *x)
on the node of , the end if is the head
Definition ThreadedTree.h:160
bool contains(const K &k) const
whether is there, by the search of a binary search tree that stops at a thread
const_iterator cbegin(void) const
as begin()
Definition ThreadedTree.h:217
const_iterator begin(void) const
the iterator on the least key, the successor of the head
Definition ThreadedTree.h:207
std::size_t size(void) const
the number of keys
void forEach(F &&f) const
f( k ) on the keys by increasing order, by the threads: no stack, no recursion
const_iterator cend(void) const
as end()
Definition ThreadedTree.h:220
const_iterator end(void) const
the iterator past the largest key, the head
Definition ThreadedTree.h:212
std::vector< K > reversed(void) const
the keys by decreasing order, by the left threads, as forEach() with the predecessors
ThreadedTree(const ThreadedTree &)=delete
no copy
std::ptrdiff_t difference_type
the type of the distances
Definition ThreadedTree.h:201
K value_type
the type of the keys
Definition ThreadedTree.h:199
const_iterator iterator
a constant iterator
Definition ThreadedTree.h:204
ThreadedTree & operator=(const ThreadedTree &)=delete
no copy
ThreadedTree(void)
the empty tree, the head node alone, its left link a thread to itself
const K & reference
a constant reference
Definition ThreadedTree.h:202
std::size_t size_type
the type of the sizes
Definition ThreadedTree.h:200
void insert(const K &k)
inserts , if it is not there
~ThreadedTree()
frees the nodes
const K & const_reference
a constant reference
Definition ThreadedTree.h:203