OpenTTD Source 20260614-master-g1baea6b0fb
EnumRange< Tenum > Class Template Reference

Iterate a range of enum values. More...

#include <enum_type.hpp>

Data Structures

class  Iterator
 Forward iterator. More...

Public Member Functions

constexpr EnumRange (Tenum first, Tenum last)
 Construct an EnumRange from first to last.
constexpr EnumRange (Tenum last)
 Construct an EnumRange from default to last.
constexpr Iterator begin () const
 Get the begin iterator for this range.
constexpr Iterator end () const
 Get the end iterator for this range.

Private Attributes

Tenum first
 The first (inclusive) value of the range.
Tenum last
 The last (exclusive) value of the range.

Detailed Description

template<typename Tenum>
class EnumRange< Tenum >

Iterate a range of enum values.

Template Parameters
TenumThe enum type.

Definition at line 209 of file enum_type.hpp.

Constructor & Destructor Documentation

◆ EnumRange() [1/2]

template<typename Tenum>
EnumRange< Tenum >::EnumRange ( Tenum first,
Tenum last )
inlineconstexpr

Construct an EnumRange from first to last.

Parameters
firstThe first value.
lastThe last value.

Definition at line 219 of file enum_type.hpp.

References first, and last.

Referenced by EnumRange().

◆ EnumRange() [2/2]

template<typename Tenum>
EnumRange< Tenum >::EnumRange ( Tenum last)
inlineconstexpr

Construct an EnumRange from default to last.

Parameters
lastThe last value.

Definition at line 225 of file enum_type.hpp.

References EnumRange(), and last.

Member Function Documentation

◆ begin()

template<typename Tenum>
Iterator EnumRange< Tenum >::begin ( ) const
inlineconstexpr

Get the begin iterator for this range.

Returns
Begin iterator.

Definition at line 277 of file enum_type.hpp.

References first.

◆ end()

template<typename Tenum>
Iterator EnumRange< Tenum >::end ( ) const
inlineconstexpr

Get the end iterator for this range.

Returns
End iterator.

Definition at line 283 of file enum_type.hpp.

References last.

Field Documentation

◆ first

template<typename Tenum>
Tenum EnumRange< Tenum >::first
private

The first (inclusive) value of the range.

Definition at line 211 of file enum_type.hpp.

Referenced by begin(), and EnumRange().

◆ last

template<typename Tenum>
Tenum EnumRange< Tenum >::last
private

The last (exclusive) value of the range.

Definition at line 212 of file enum_type.hpp.

Referenced by end(), EnumRange(), and EnumRange().


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