Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iterator operator++(int)
- {
- iterator old(this->current, this->tree);
- if (this->current->rth)
- this->current = this->current->right;
- else
- {
- this->current = this->current->right;
- while (!this->current->lth)
- this->current = this->current->left;
- }
- return old;
- }
- iterator operator--(int)
- {
- iterator old(this->current, this->tree);
- if (!this->current)
- {
- this->current = this->tree->root;
- while (!this->current->rth)
- this->current = this->current->right;
- }
- else if (this->current->lth)
- this->current = this->current->left;
- else
- {
- this->current = this->current->left;
- while (!this->current->rth)
- this->current = this->current->right;
- }
- return old;
- }
- iterator operator++()
- {
- if (this->current->rth)
- this->current = this->current->right;
- else
- {
- this->current = this->current->right;
- while (!this->current->lth)
- this->current = this->current->left;
- }
- return *this;
- }
- iterator operator--()
- {
- if (!this->current)
- {
- this->current = this->tree->root;
- while (!this->current->rth)
- this->current = this->current->right;
- }
- else if (this->current->lth)
- this->current = this->current->left;
- else
- {
- this->current = this->current->left;
- while (!this->current->rth)
- this->current = this->current->right;
- }
- return *this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement