EnTT: entt::monostate< id_type > Struct Template Reference

EnTT 3.16.0

Loading...
Searching...
No Matches
Public Member Functions | List of all members
entt::monostate< id_type > Struct Template Reference

Minimal implementation of the monostate pattern. More...

`#include <monostate.hpp>`

## Public Member Functions
template<typename Type>
monostate & | operator= (Type val) noexcept
| Assigns a value of a specific type to a given key.
template<typename Type>
| operator Type () const noexcept
| Gets a value of a specific type for a given key.

## Detailed Description

template<id_type>
struct entt::monostate< id_type >

Minimal implementation of the monostate pattern.

A minimal, yet complete configuration system built on top of the monostate pattern. Thread safe by design, it works only with basic types like ints or bools.
Multiple types and therefore more than one value can be associated with a single key. Because of this, users must pay attention to use the same type both during an assignment and when they try to read back their data. Otherwise, they can incur in unexpected results.

Definition at line 21 of file monostate.hpp.

## Member Function Documentation

## ◆ operator Type()

template<id_type>
template<typename Type>

entt::monostate< id_type >::operator Type | ( |  | ) | const
| inlinenoexcept

Gets a value of a specific type for a given key.

Template Parameters

  Type | Type of the value to get.

Returns
  Stored value, if any.

Definition at line 40 of file monostate.hpp.

## ◆ operator=()

template<id_type>
template<typename Type>

monostate & entt::monostate< id_type >::operator= | ( | Type | val | ) |
| inlinenoexcept

Assigns a value of a specific type to a given key.

Template Parameters

  Type | Type of the value to assign.

Parameters

  val | User data to assign to the given key.

Returns
  This monostate object.

Definition at line 29 of file monostate.hpp.

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

- src/entt/core/monostate.hpp