WholeEnum< EnumType > Class Template Reference

#include <EnumIterator.h>

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

Public Types

typedef EnumIterator< EnumType > iterator
 
typedef ReverseEnumIterator< EnumType > reverse_iterator
 

Public Member Functions

 WholeEnum ()
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 

Private Attributes

EnumType begin_
 
EnumType end_
 

Detailed Description

template<typename EnumType>
class WholeEnum< EnumType >

Class expressing a continuous range of a whole enum for range-for expressions

Class for iterating all enum values, from EnumType::enumBegin_ up to, but not including, EnumType::enumEnd_.

This class requires that:

  • the underlying enum values be represented by continuous values of an integral type.
  • both enumBegin_ and enumEnd_ markers must be present as EnumType values;
  • enumBegin_ must have the same representation as the first element of the enum
  • enumEnd_ must have a representation that is one past the last user-accessible value of the enum.

Typical use:

enum class EnumType {
first_value = enumBegin_,
second_value,
};
for(auto enumvalue : WholeEnum<EnumType>()) {
do_stuff();
}

Definition at line 221 of file EnumIterator.h.

Member Typedef Documentation

◆ iterator

template<typename EnumType >
typedef EnumIterator<EnumType> EnumRangeT< EnumType >::iterator
inherited

Definition at line 160 of file EnumIterator.h.

◆ reverse_iterator

template<typename EnumType >
typedef ReverseEnumIterator<EnumType> EnumRangeT< EnumType >::reverse_iterator
inherited

Definition at line 161 of file EnumIterator.h.

Constructor & Destructor Documentation

◆ WholeEnum()

template<typename EnumType >
WholeEnum< EnumType >::WholeEnum ( )
inline

Definition at line 224 of file EnumIterator.h.

Member Function Documentation

◆ begin()

template<typename EnumType >
iterator EnumRangeT< EnumType >::begin ( ) const
inlineinherited

◆ end()

template<typename EnumType >
iterator EnumRangeT< EnumType >::end ( ) const
inlineinherited

Definition at line 164 of file EnumIterator.h.

References EnumRangeT< EnumType >::end_.

Referenced by TestEnumIterator::testBidirectionalIter().

◆ rbegin()

template<typename EnumType >
reverse_iterator EnumRangeT< EnumType >::rbegin ( ) const
inlineinherited

Definition at line 165 of file EnumIterator.h.

References EnumRangeT< EnumType >::end_.

Referenced by TestEnumIterator::testReverseIter().

◆ rend()

template<typename EnumType >
reverse_iterator EnumRangeT< EnumType >::rend ( ) const
inlineinherited

Definition at line 166 of file EnumIterator.h.

References EnumRangeT< EnumType >::begin_.

Referenced by TestEnumIterator::testUnsignedEnum().

Member Data Documentation

◆ begin_

template<typename EnumType >
EnumType EnumRangeT< EnumType >::begin_
privateinherited

Definition at line 168 of file EnumIterator.h.

Referenced by EnumRangeT< EnumType >::begin(), and EnumRangeT< EnumType >::rend().

◆ end_

template<typename EnumType >
EnumType EnumRangeT< EnumType >::end_
privateinherited

Definition at line 169 of file EnumIterator.h.

Referenced by EnumRangeT< EnumType >::end(), and EnumRangeT< EnumType >::rbegin().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors