OpenTTD Source: StrongType::Typedef< TBaseType, TTag, TProperties > Struct Template Reference

OpenTTD Source 14.0-RC3

Public Types | Public Member Functions | Data Fields | Friends
StrongType::Typedef< TBaseType, TTag, TProperties > 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 StrongType::Typedef< TBaseType, TTag, TProperties >:

## Public Types
using | BaseType = TBaseType

## Public Member Functions
constexpr | Typedef (const Typedef &)=default
constexpr | Typedef (Typedef &&)=default
constexpr | Typedef (const TBaseType &value)
constexpr Typedef & | operator= (const Typedef &rhs)
constexpr Typedef & | operator= (Typedef &&rhs)
constexpr Typedef & | operator= (const TBaseType &rhs)
constexpr TBaseType | base () const

## Data Fields
TBaseType | value {}

## Friends
struct | Compare
struct | Integer
template<typename TCompatibleType >
struct | Compatible

## Detailed Description

### template<typename TBaseType, typename TTag, typename... TProperties>
struct StrongType::Typedef< TBaseType, TTag, TProperties >

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.

Example usage:

using MyType = StrongType::Typedef<int, struct MyTypeTag, StrongType::Explicit, StrongType::Compare, StrongType::Integer>;

Template Parameters

  TBaseType | Type of the derived class (i.e. the concrete usage of this class).
  TTag | An unique struct to keep types of the same TBaseType distinct.
  TProperties | A list of mixins to add to the class.

Definition at line 150 of file strong_typedef_type.hpp.

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

- src/core/strong_typedef_type.hpp