OpenTTD Source 20260206-master-g4d4e37dbf1
PoolID< TBaseType, TTag, TEnd, TInvalid > Struct Template Reference

Templated helper to make a PoolID a single POD value. More...

#include <pool_type.hpp>

Inheritance diagram for PoolID< TBaseType, TTag, TEnd, TInvalid >:
PoolIDBase

Public Types

using BaseType = TBaseType

Public Member Functions

constexpr PoolID (const PoolID &)=default
constexpr PoolID (PoolID &&)=default
constexpr PoolID (const TBaseType &value)
constexpr PoolIDoperator= (const PoolID &rhs)
constexpr PoolIDoperator= (PoolID &&rhs)
constexpr TBaseType base () const noexcept
constexpr auto operator++ ()
constexpr auto operator+ (const std::integral auto &val) const
constexpr auto operator- (const std::integral auto &val) const
constexpr auto operator% (const std::integral auto &val) const
constexpr bool operator== (const PoolID< TBaseType, TTag, TEnd, TInvalid > &rhs) const
constexpr auto operator<=> (const PoolID< TBaseType, TTag, TEnd, TInvalid > &rhs) const
constexpr bool operator== (const size_t &rhs) const
constexpr auto operator<=> (const size_t &rhs) const

Static Public Member Functions

static constexpr PoolID Begin ()
static constexpr PoolID End ()
static constexpr PoolID Invalid ()

Private Attributes

TBaseType value

Detailed Description

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
struct PoolID< TBaseType, TTag, TEnd, TInvalid >

Templated helper to make a PoolID a single POD value.

Example usage:

using MyType = PoolID<int, struct MyTypeTag, 16, 0xFF>;

Template Parameters
TBaseTypeType of the derived class (i.e. the concrete usage of this class).
TTagAn unique struct to keep types of the same TBaseType distinct.
TEndThe PoolID at the end of the pool (equivalent to size).
TInvalidThe PoolID denoting an invalid value.

Definition at line 47 of file pool_type.hpp.

Member Typedef Documentation

◆ BaseType

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
using PoolID< TBaseType, TTag, TEnd, TInvalid >::BaseType = TBaseType

Definition at line 48 of file pool_type.hpp.

Constructor & Destructor Documentation

◆ PoolID()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
PoolID< TBaseType, TTag, TEnd, TInvalid >::PoolID ( const TBaseType & value)
inlineexplicitconstexpr

Definition at line 54 of file pool_type.hpp.

Member Function Documentation

◆ base()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
TBaseType PoolID< TBaseType, TTag, TEnd, TInvalid >::base ( ) const
inlineconstexprnoexcept

Definition at line 60 of file pool_type.hpp.

◆ Begin()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
constexpr PoolID PoolID< TBaseType, TTag, TEnd, TInvalid >::Begin ( )
inlinestaticconstexpr

Definition at line 62 of file pool_type.hpp.

◆ End()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
constexpr PoolID PoolID< TBaseType, TTag, TEnd, TInvalid >::End ( )
inlinestaticconstexpr

Definition at line 63 of file pool_type.hpp.

◆ Invalid()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
constexpr PoolID PoolID< TBaseType, TTag, TEnd, TInvalid >::Invalid ( )
inlinestaticconstexpr

Definition at line 64 of file pool_type.hpp.

◆ operator%()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
auto PoolID< TBaseType, TTag, TEnd, TInvalid >::operator% ( const std::integral auto & val) const
inlineconstexpr

Definition at line 69 of file pool_type.hpp.

◆ operator+()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
auto PoolID< TBaseType, TTag, TEnd, TInvalid >::operator+ ( const std::integral auto & val) const
inlineconstexpr

Definition at line 67 of file pool_type.hpp.

◆ operator++()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
auto PoolID< TBaseType, TTag, TEnd, TInvalid >::operator++ ( )
inlineconstexpr

Definition at line 66 of file pool_type.hpp.

◆ operator-()

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
auto PoolID< TBaseType, TTag, TEnd, TInvalid >::operator- ( const std::integral auto & val) const
inlineconstexpr

Definition at line 68 of file pool_type.hpp.

◆ operator<=>() [1/2]

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
auto PoolID< TBaseType, TTag, TEnd, TInvalid >::operator<=> ( const PoolID< TBaseType, TTag, TEnd, TInvalid > & rhs) const
inlineconstexpr

Definition at line 72 of file pool_type.hpp.

◆ operator<=>() [2/2]

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
auto PoolID< TBaseType, TTag, TEnd, TInvalid >::operator<=> ( const size_t & rhs) const
inlineconstexpr

Definition at line 75 of file pool_type.hpp.

◆ operator=() [1/2]

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
PoolID & PoolID< TBaseType, TTag, TEnd, TInvalid >::operator= ( const PoolID< TBaseType, TTag, TEnd, TInvalid > & rhs)
inlineconstexpr

Definition at line 56 of file pool_type.hpp.

◆ operator=() [2/2]

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
PoolID & PoolID< TBaseType, TTag, TEnd, TInvalid >::operator= ( PoolID< TBaseType, TTag, TEnd, TInvalid > && rhs)
inlineconstexpr

Definition at line 57 of file pool_type.hpp.

◆ operator==() [1/2]

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
bool PoolID< TBaseType, TTag, TEnd, TInvalid >::operator== ( const PoolID< TBaseType, TTag, TEnd, TInvalid > & rhs) const
inlineconstexpr

Definition at line 71 of file pool_type.hpp.

◆ operator==() [2/2]

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
bool PoolID< TBaseType, TTag, TEnd, TInvalid >::operator== ( const size_t & rhs) const
inlineconstexpr

Definition at line 74 of file pool_type.hpp.

Field Documentation

◆ value

template<typename TBaseType, typename TTag, TBaseType TEnd, TBaseType TInvalid>
TBaseType PoolID< TBaseType, TTag, TEnd, TInvalid >::value
private

Definition at line 78 of file pool_type.hpp.


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