Template Class forward_iterator

Class Documentation

template<typename ElementType, typename ImplementationType, typename Friend>
class forward_iterator

This class is used so we can provide iterators for various container classes without exposing any implementation details about what kind of STL container we are using inside of our container class. This allows us to guarantee ABI stability, even if we decide to change what STL container we use inside of our implementation.

This class is designed to offer only the most basic features of a forward iterator.

Public Types

using Element = ElementType
using Implementation = ImplementationType

Public Functions

Element &operator*() const

Dereference operator.

Element *operator->() const

Drill-down operator.

forward_iterator &operator++()

Pre-increment operator: ++it

Note

This is more efficient than the post-increment operator.

Returns:

a reference to the iterator that was operated on

forward_iterator operator++(int)

Post-increment operator: it++

Returns:

a copy of the iterator before it was incremented

bool operator==(const forward_iterator &other) const

Equality comparison operator.

bool operator!=(const forward_iterator &other) const

Inequality comparison operator.

operator forward_iterator<const Element, Implementation, Friend>() const
forward_iterator(const forward_iterator&) = default
forward_iterator(forward_iterator&&) = default
forward_iterator &operator=(const forward_iterator&) = default
forward_iterator &operator=(forward_iterator&&) = default
forward_iterator()