OpenTTD Source 20260421-master-gc2fbc6fdeb
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 (const Index &pos)
Container::const_reference at (const Index &pos) const
Container::reference operator[] (const Index &pos)
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/2]

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

Definition at line 40 of file convertible_through_base.hpp.

◆ at() [2/2]

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

Definition at line 42 of file convertible_through_base.hpp.

◆ operator[]() [1/2]

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

Definition at line 44 of file convertible_through_base.hpp.

◆ operator[]() [2/2]

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

Definition at line 46 of file convertible_through_base.hpp.


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