OpenTTD Source 20250703-master-gbf07751ee7
TypedIndexContainer< Container, Index > Class Template Reference

A sort-of mixin that implements 'at(pos)' and 'operator[](pos)' only for a specific type. More...

#include <convertible_through_base.hpp>

Inheritance diagram for TypedIndexContainer< Container, Index >:

Public Member Functions

Container::reference at (size_t pos)
 
Container::reference at (const Index &pos)
 
Container::const_reference at (size_t pos) const
 
Container::const_reference at (const Index &pos) const
 
Container::reference operator[] (size_t pos)
 
Container::reference operator[] (const Index &pos)
 
Container::const_reference operator[] (size_t pos) const
 
Container::const_reference operator[] (const Index &pos) const
 

Detailed Description

template<typename Container, typename Index>
class TypedIndexContainer< Container, Index >

A sort-of mixin that implements 'at(pos)' and 'operator[](pos)' only for a specific type.

The type must have a suitable '.base()' method and therefore must inherently match 'ConvertibleThroughBase'. This to prevent having to call '.base()' for many container accesses, whilst preventing accidental use of the wrong index type.

Definition at line 38 of file convertible_through_base.hpp.

Member Function Documentation

◆ at() [1/4]

template<typename Container , typename Index >
Container::reference TypedIndexContainer< Container, Index >::at ( const Index &  pos)
inline

Definition at line 41 of file convertible_through_base.hpp.

◆ at() [2/4]

template<typename Container , typename Index >
Container::const_reference TypedIndexContainer< Container, Index >::at ( const Index &  pos) const
inline

Definition at line 44 of file convertible_through_base.hpp.

◆ at() [3/4]

template<typename Container , typename Index >
Container::reference TypedIndexContainer< Container, Index >::at ( size_t  pos)
inline

Definition at line 40 of file convertible_through_base.hpp.

◆ at() [4/4]

template<typename Container , typename Index >
Container::const_reference TypedIndexContainer< Container, Index >::at ( size_t  pos) const
inline

Definition at line 43 of file convertible_through_base.hpp.

◆ operator[]() [1/4]

template<typename Container , typename Index >
Container::reference TypedIndexContainer< Container, Index >::operator[] ( const Index &  pos)
inline

Definition at line 47 of file convertible_through_base.hpp.

◆ operator[]() [2/4]

template<typename Container , typename Index >
Container::const_reference TypedIndexContainer< Container, Index >::operator[] ( const Index &  pos) const
inline

Definition at line 50 of file convertible_through_base.hpp.

◆ operator[]() [3/4]

template<typename Container , typename Index >
Container::reference TypedIndexContainer< Container, Index >::operator[] ( size_t  pos)
inline

Definition at line 46 of file convertible_through_base.hpp.

◆ operator[]() [4/4]

template<typename Container , typename Index >
Container::const_reference TypedIndexContainer< Container, Index >::operator[] ( size_t  pos) const
inline

Definition at line 49 of file convertible_through_base.hpp.


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