iterator_pattern::ConcreteIterator

template<typename T>
class ConcreteIterator : public iterator_pattern::Iterator<T>

Concrete Iterator for traversing a collection.

Implements the Iterator interface and provides traversal logic.

Public Functions

inline explicit ConcreteIterator(const std::vector<T> &collection)

Constructor initializes the iterator with a collection.

Parameters:

collection – The collection to iterate over.

inline virtual bool hasNext() const override

Check if there are more elements in the collection.

Returns:

True if there are more elements, otherwise false.

inline virtual T next() override

Retrieve the next element in the collection.

Throws:

std::out_of_range – if there are no more elements.

Returns:

The next element.