You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
408 B
C++

#pragma once
#include "iterators/BaseIterator.h"
template <typename T>
struct IteratorForward : public BaseIterator<T> {
explicit IteratorForward(T* ptr) : Iterator<T>(first(ptr)) {}
static T* first(T* node) {
return node;
}
static T* next(T* node) {
return node ? node->get_next() : nullptr;
}
Iterator<T>& operator++() override {
this->current = next(this->current);
return *this;
}
};