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

Forward iterator. More...

#include <enum_type.hpp>

Public Types

using value_type = Tenum
 C++ specification trait 'value_type' of this Iterator.
using difference_type = value_type &
 C++ specification trait 'difference_type' of this Iterator.
using iterator_category = std::forward_iterator_tag
 C++ specification trait 'iterator_category' of this Iterator.
using pointer = void
 C++ specification trait 'pointer' of this Iterator.
using reference = void
 C++ specification trait 'reference' of this Iterator.

Public Member Functions

 Iterator (Tenum v)
 Construct this iterator.
constexpr Tenum operator* () const
 Deference operator.
constexpr Iteratoroperator++ ()
 Increment to the next value.
constexpr auto operator<=> (const Iterator &) const =default
 Compare with another instance of this iterator.

Private Attributes

Tenum value
 Current value.

Detailed Description

template<typename Tenum>
class EnumRange< Tenum >::Iterator

Forward iterator.

Definition at line 230 of file enum_type.hpp.

Member Typedef Documentation

◆ difference_type

template<typename Tenum>
using EnumRange< Tenum >::Iterator::difference_type = value_type &

C++ specification trait 'difference_type' of this Iterator.

Definition at line 233 of file enum_type.hpp.

◆ iterator_category

template<typename Tenum>
using EnumRange< Tenum >::Iterator::iterator_category = std::forward_iterator_tag

C++ specification trait 'iterator_category' of this Iterator.

Definition at line 234 of file enum_type.hpp.

◆ pointer

template<typename Tenum>
using EnumRange< Tenum >::Iterator::pointer = void

C++ specification trait 'pointer' of this Iterator.

Definition at line 235 of file enum_type.hpp.

◆ reference

template<typename Tenum>
using EnumRange< Tenum >::Iterator::reference = void

C++ specification trait 'reference' of this Iterator.

Definition at line 236 of file enum_type.hpp.

◆ value_type

template<typename Tenum>
using EnumRange< Tenum >::Iterator::value_type = Tenum

C++ specification trait 'value_type' of this Iterator.

Definition at line 232 of file enum_type.hpp.

Constructor & Destructor Documentation

◆ Iterator()

template<typename Tenum>
EnumRange< Tenum >::Iterator::Iterator ( Tenum v)
inlineexplicit

Construct this iterator.

Parameters
vThe initial value.

Definition at line 242 of file enum_type.hpp.

References value.

Referenced by operator++(), and operator<=>().

Member Function Documentation

◆ operator*()

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

Deference operator.

Returns
The current value.

Definition at line 248 of file enum_type.hpp.

References value.

◆ operator++()

template<typename Tenum>
Iterator & EnumRange< Tenum >::Iterator::operator++ ( )
inlineconstexpr

Increment to the next value.

Returns
The iterator.

Definition at line 257 of file enum_type.hpp.

References Iterator(), to_underlying(), and value.

◆ operator<=>()

template<typename Tenum>
auto EnumRange< Tenum >::Iterator::operator<=> ( const Iterator & ) const
constexprdefault

Compare with another instance of this iterator.

Returns
The std::strong_ordering of the comparison.

References Iterator().

Field Documentation

◆ value

template<typename Tenum>
Tenum EnumRange< Tenum >::Iterator::value
private

Current value.

Definition at line 270 of file enum_type.hpp.

Referenced by Iterator(), operator*(), and operator++().


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