Template Class bidirectional_iterator

Class Documentation

template<typename ElementType, typename ImplementationType, typename Friend>
class bidirectional_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 bidirectional iterator.

Public Types

using Element = ElementType
using Implementation = ImplementationType

Public Functions

Element &operator*() const

Dereference operator.

Element *operator->() const

Drill-down operator.

bidirectional_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

bidirectional_iterator &operator--()

Pre-decrement operator: &#8212;it

Note

This is more efficient than the post-decrement operator

Returns:

a reference to the iterator that was operated on

bidirectional_iterator operator++(int)

Post-increment operator: it++

Returns:

a copy of the iterator before it was incremented

bidirectional_iterator operator--(int)

Post-decrement operator: it&#8212;

Returns:

a copy of the iterator before it was decremented

bool operator==(const bidirectional_iterator &other) const

Equality comparison operator.

bool operator!=(const bidirectional_iterator &other) const

Inequality comparison operator.

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