Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::UniqueValue< T > Struct Template Reference

A value that is cleared when it is moved from. More...

#include <UniqueValue.h>

Public Member Functions

 UniqueValue (const T &value)
 
 UniqueValue (const UniqueValue &)=delete
 
 UniqueValue (UniqueValue &&other) noexcept
 
UniqueValueoperator= (const UniqueValue &)=delete
 
UniqueValueoperator= (UniqueValue &&other) noexcept
 

Public Attributes

value = T(0)
 

Detailed Description

template<typename T>
struct Cogs::UniqueValue< T >

A value that is cleared when it is moved from.

Use case is to have a bool/flag member that tags ownership, and this tag is not duplicated when the enclosing object is moved, but is cleared in the object moved from.

Definition at line 13 of file UniqueValue.h.

Constructor & Destructor Documentation

◆ UniqueValue() [1/2]

template<typename T >
Cogs::UniqueValue< T >::UniqueValue ( const T &  value)
inline

Definition at line 15 of file UniqueValue.h.

◆ UniqueValue() [2/2]

template<typename T >
Cogs::UniqueValue< T >::UniqueValue ( UniqueValue< T > &&  other)
inlinenoexcept

Definition at line 17 of file UniqueValue.h.

Member Function Documentation

◆ operator=()

template<typename T >
UniqueValue & Cogs::UniqueValue< T >::operator= ( UniqueValue< T > &&  other)
inlinenoexcept

Definition at line 20 of file UniqueValue.h.

Member Data Documentation

◆ value

template<typename T >
T Cogs::UniqueValue< T >::value = T(0)

Definition at line 22 of file UniqueValue.h.


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