ReverseEnumIterator< EnumType > Class Template Reference

#include <EnumIterator.h>

Inheritance diagram for ReverseEnumIterator< EnumType >:
Collaboration diagram for ReverseEnumIterator< EnumType >:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 
using value_type = EnumType
 
using difference_type = std::ptrdiff_t
 
using pointer = EnumType *
 
using reference = EnumType &
 

Public Member Functions

 ReverseEnumIterator (EnumType e)
 
ReverseEnumIteratoroperator++ ()
 
ReverseEnumIteratoroperator++ (int)
 
ReverseEnumIteratoroperator-- ()
 
ReverseEnumIteratoroperator-- (int)
 
bool operator== (const EnumIteratorBase &i) const
 
bool operator!= (const EnumIteratorBase &i) const
 
EnumType operator* () const
 

Protected Types

typedef std::underlying_type< EnumType >::type iterator_type
 

Protected Attributes

iterator_type current
 

Detailed Description

template<typename EnumType>
class ReverseEnumIterator< EnumType >

bidirectional reverse iterator over an enum type

It can be instantiated using any enum (or C++11 strongly-typed enum) value; the most common expected use scenario has iterators emitted by EnumRange and WholeEnum via standard rbegin() and rend() calls.

In order for the iterator to work, it is mandatory that the underlying enum type's representation values be sequential.

The iterator does not check for bounds; behavior is undefined if the iterator is incremented (or decremented) outside the range representing valid enum symbols (remember: an enum is not a data structure).

See also
EnumRange, WholeEnum, EnumIterator

Definition at line 111 of file EnumIterator.h.

Member Typedef Documentation

◆ difference_type

template<typename EnumType >
using EnumIteratorBase< EnumType >::difference_type = std::ptrdiff_t
inherited

Definition at line 31 of file EnumIterator.h.

◆ iterator_category

template<typename EnumType >
using EnumIteratorBase< EnumType >::iterator_category = std::bidirectional_iterator_tag
inherited

Definition at line 29 of file EnumIterator.h.

◆ iterator_type

template<typename EnumType >
typedef std::underlying_type<EnumType>::type EnumIteratorBase< EnumType >::iterator_type
protectedinherited

Definition at line 26 of file EnumIterator.h.

◆ pointer

template<typename EnumType >
using EnumIteratorBase< EnumType >::pointer = EnumType *
inherited

Definition at line 32 of file EnumIterator.h.

◆ reference

template<typename EnumType >
using EnumIteratorBase< EnumType >::reference = EnumType &
inherited

Definition at line 33 of file EnumIterator.h.

◆ value_type

template<typename EnumType >
using EnumIteratorBase< EnumType >::value_type = EnumType
inherited

Definition at line 30 of file EnumIterator.h.

Constructor & Destructor Documentation

◆ ReverseEnumIterator()

template<typename EnumType >
ReverseEnumIterator< EnumType >::ReverseEnumIterator ( EnumType  e)
inlineexplicit

Definition at line 114 of file EnumIterator.h.

Member Function Documentation

◆ operator!=()

template<typename EnumType >
bool EnumIteratorBase< EnumType >::operator!= ( const EnumIteratorBase< EnumType > &  i) const
inlineinherited

Definition at line 41 of file EnumIterator.h.

References EnumIteratorBase< EnumType >::current.

◆ operator*()

template<typename EnumType >
EnumType EnumIteratorBase< EnumType >::operator* ( ) const
inlineinherited

Definition at line 45 of file EnumIterator.h.

References EnumIteratorBase< EnumType >::current.

◆ operator++() [1/2]

template<typename EnumType >
ReverseEnumIterator & ReverseEnumIterator< EnumType >::operator++ ( )
inline

Definition at line 117 of file EnumIterator.h.

◆ operator++() [2/2]

template<typename EnumType >
ReverseEnumIterator & ReverseEnumIterator< EnumType >::operator++ ( int  )
inline

Definition at line 123 of file EnumIterator.h.

◆ operator--() [1/2]

template<typename EnumType >
ReverseEnumIterator & ReverseEnumIterator< EnumType >::operator-- ( )
inline

Definition at line 130 of file EnumIterator.h.

◆ operator--() [2/2]

template<typename EnumType >
ReverseEnumIterator & ReverseEnumIterator< EnumType >::operator-- ( int  )
inline

Definition at line 136 of file EnumIterator.h.

◆ operator==()

template<typename EnumType >
bool EnumIteratorBase< EnumType >::operator== ( const EnumIteratorBase< EnumType > &  i) const
inlineinherited

Definition at line 37 of file EnumIterator.h.

References EnumIteratorBase< EnumType >::current.

Member Data Documentation

◆ current

template<typename EnumType >
iterator_type EnumIteratorBase< EnumType >::current
protectedinherited

The documentation for this class was generated from the following file:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors