OpenLexocad  27.1
entt::monostate< ENTT_ID_TYPE > Struct Template Reference

Minimal implementation of the monostate pattern. More...

#include <entt.hpp>

Public Member Functions

template<typename Type >
void operator= (Type val) const ENTT_NOEXCEPT
 Assigns a value of a specific type to a given key. More...
 
template<typename Type >
 operator Type () const ENTT_NOEXCEPT
 Gets a value of a specific type for a given key. More...
 

Detailed Description

template<ENTT_ID_TYPE>
struct entt::monostate< ENTT_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.

Member Function Documentation

◆ operator Type()

template<ENTT_ID_TYPE >
template<typename Type >
entt::monostate< ENTT_ID_TYPE >::operator Type ( ) const
inline

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

Template Parameters
TypeType of the value to get.
Returns
Stored value, if any.

◆ operator=()

template<ENTT_ID_TYPE >
template<typename Type >
void entt::monostate< ENTT_ID_TYPE >::operator= ( Type  val) const
inline

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.

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