Cogs.Foundation
Loading...
Searching...
No Matches
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 ()=default
 
 UniqueValue (const T &value)
 
 UniqueValue (const UniqueValue &)=delete
 
 UniqueValue (UniqueValue &&other) noexcept
 
UniqueValueoperator= (const UniqueValue &)=delete
 
UniqueValueoperator= (UniqueValue &&other) noexcept
 

Public Attributes

T 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.

Constructor & Destructor Documentation

◆ UniqueValue() [1/4]

template<typename T >
Cogs::UniqueValue< T >::UniqueValue ( )
default

◆ UniqueValue() [2/4]

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

◆ UniqueValue() [3/4]

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

◆ UniqueValue() [4/4]

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

References Cogs::T.

Member Function Documentation

◆ operator=() [1/2]

template<typename T >
UniqueValue & Cogs::UniqueValue< T >::operator= ( const UniqueValue< T > &  )
delete

◆ operator=() [2/2]

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

Member Data Documentation

◆ value

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

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