EnumIterator.h File Reference
#include <iterator>
#include <type_traits>
Include dependency graph for EnumIterator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  EnumIteratorBase< EnumType >
 
class  EnumIterator< EnumType >
 
class  ReverseEnumIterator< EnumType >
 
class  EnumRangeT< EnumType >
 
class  WholeEnum< EnumType >
 

Functions

template<typename EnumType >
EnumRangeT< EnumType > EnumRange (EnumType begin, EnumType one_past_end)
 
template<auto First, auto Last, class F >
constexpr void ConstexprForEnum (F &&f)
 

Function Documentation

◆ ConstexprForEnum()

template<auto First, auto Last, class F >
constexpr void ConstexprForEnum ( F &&  f)
constexpr

Compile-time iteration of sequential enum values from First to Last, inclusive. The given function is called once on each iteration, with the current enum value as an argument.

Definition at line 232 of file EnumIterator.h.

◆ EnumRange()

template<typename EnumType >
EnumRangeT<EnumType> EnumRange ( EnumType  begin,
EnumType  one_past_end 
)

Generate a continuous range of an enum for range-for expressions

convenience function to deduce the right type for instantiating EnumRangeT. See EnumRangeT for more detailed documentation and caveats.

Typical use:

enum class EnumType {
blue, red, yellow, green, pink
};
for (auto enumvalue : EnumRange(EnumType::red,EnumType::green)) {
do_stuff(enumvalue); // will be called twice, with arguments red and yellow
}

Definition at line 188 of file EnumIterator.h.

Referenced by TestEnumIterator::testRangeForRange(), and ProxyProtocol::Header::toMime().

EnumRangeT< EnumType > EnumRange(EnumType begin, EnumType one_past_end)
Definition: EnumIterator.h:188

 

Introduction

Documentation

Support

Miscellaneous