OpenTTD Source: StrongTypedef< T, Tthis > Struct Template Reference

OpenTTD Source 13.2.1

Public Types | Public Member Functions | Data Fields
StrongTypedef< T, Tthis > Struct Template Reference

Templated helper to make a type-safe 'typedef' representing a single POD value. More...

`#include <strong_typedef_type.hpp>`

Inheritance diagram for StrongTypedef< T, Tthis >:

## Public Types
using | Type = T

## Public Member Functions
constexpr | StrongTypedef (const StrongTypedef &o)=default
constexpr | StrongTypedef (StrongTypedef &&o)=default
constexpr | StrongTypedef (const T &value)
constexpr Tthis & | operator= (const StrongTypedef &rhs)
constexpr Tthis & | operator= (StrongTypedef &&rhs)
constexpr Tthis & | operator= (const T &rhs)
constexpr | operator T () const
constexpr bool | operator== (const StrongTypedef &rhs) const
constexpr bool | operator!= (const StrongTypedef &rhs) const
constexpr bool | operator== (const T &rhs) const
constexpr bool | operator!= (const T &rhs) const

## Data Fields
T | value {}
| Backing storage field.

## Detailed Description

### template<class T, class Tthis>
struct StrongTypedef< T, Tthis >

Templated helper to make a type-safe 'typedef' representing a single POD value.

A normal 'typedef' is not distinct from its base type and will be treated as identical in many contexts. This class provides a distinct type that can still be assign from and compared to values of its base type.

Note
  This is meant to be used as a base class, not directly.

Template Parameters

  T | Storage type
  Tthis | Type of the derived class (i.e. the concrete usage of this class).

Definition at line 27 of file strong_typedef_type.hpp.

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

- src/core/strong_typedef_type.hpp