Advanced Programming - Binary Search Tree
A simple Binary Search Tree implementation for the Advanced Programming 2019-2020 course @ SISSA.
|
Class that implements an iterator of a tree. More...
#include <Iterator.hpp>
Public Types | |
using | value_type = T |
Type of the data stored by Node. More... | |
using | reference = value_type & |
using | pointer = value_type * |
using | iterator_category = std::forward_iterator_tag |
using | difference_type = std::ptrdiff_t |
Public Member Functions | |
__iterator (nodeT *n) noexcept | |
Constructor. More... | |
reference | operator* () const noexcept |
Dereference operator. More... | |
pointer | operator-> () const noexcept |
Arrow operator. More... | |
__iterator & | operator++ () noexcept |
Pre-increment operator. More... | |
__iterator | operator++ (int) noexcept |
Post-increment operator. More... | |
template<class... Types> | |
void | printNode (Types &&... args) |
Prints a tree Node. More... | |
Private Attributes | |
nodeT * | currentNode |
Node referred to by the iterator. | |
Friends | |
template<typename KT , typename VT , typename cmp > | |
class | APbst::bst |
bool | operator== (const __iterator &a, const __iterator &b) |
Equality operator. More... | |
bool | operator!= (const __iterator &a, const __iterator &b) |
Inequality operator. More... | |
Class that implements an iterator of a tree.
using APutils::__iterator< nodeT, T >::value_type = T |
Type of the data stored by Node.
E.g. std::<const Key, Value>
for APbst::bst.
|
inlineexplicitnoexcept |
|
inlinenoexcept |
Dereference operator.
Dereferences an __iterator by returning the data stored by the Node it refers to.
|
inlinenoexcept |
Pre-increment operator.
|
inlinenoexcept |
Post-increment operator.
|
inlinenoexcept |
Arrow operator.
Class member access operator; it returns a pointer to the data stored by the Node the __iterator refers to.
|
inline |
Prints a tree Node.
Forwards to Node::printNode().
|
friend |
The class APbst::bst is declared to be friend
in order to make it able to access our private member ( currentNode).
|
friend |
|
friend |
Equality operator.
Two iterators are defined equal if they point to the same node.