EnTT 3.14.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 >
monostateoperator= (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
TypeType 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
TypeType of the value to assign.
Parameters
valUser 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: