42 using iterator_category = std::forward_iterator_tag;
43 using difference_type = std::ptrdiff_t;
45 using pointer = value_type*;
46 using reference = value_type&;
66 return a.it->not_equal(*b.it);
70 std::unique_ptr<base> it;
75 using iterator_type =
typename std::vector<std::unique_ptr<T>>::iterator;
Abstract struct to implement to enable the use of the ForwardIterator<T>
Definition: custom_iterators.hpp:28
virtual bool not_equal(const ForwardIteratorBase &other)=0
Check for equality between this iterator and other.
virtual T & deref() const =0
Get a reference to the value pointed to by the iterator.
virtual void advance()=0
Increment the iterator once to the next position.
Helper struct that allows the use of an iterator in an interface, can be implemented using any forwar...
Definition: custom_iterators.hpp:41
friend bool operator!=(const ForwardIterator &a, const ForwardIterator &b)
Check for inequality between this a and b.
Definition: custom_iterators.hpp:65
reference operator*() const
Get a reference to the value pointed to by the iterator.
Definition: custom_iterators.hpp:54
ForwardIterator & operator++()
Increment the iterator once to the next position.
Definition: custom_iterators.hpp:59
ForwardIterator(std::unique_ptr< base > it)
Construct a new wrapper using any type that implements the abstract struct Base.
Definition: custom_iterators.hpp:50
Implementation for the ForwardIteratorBase based on a vector of unique_ptr with type T.
Definition: custom_iterators.hpp:74
T & deref() const override
Get a reference to the value pointed to by the iterator.
Definition: custom_iterators.hpp:81
bool not_equal(const base &other) override
Check for equality between this iterator and other.
Definition: custom_iterators.hpp:89
void advance() override
Increment the iterator once to the next position.
Definition: custom_iterators.hpp:85