Overload  1.1
Game engine with editor
Public Member Functions | List of all members
OvTools::Utils::ReferenceOrValue< T > Class Template Reference

#include <ReferenceOrValue.h>

Public Member Functions

 ReferenceOrValue (std::reference_wrapper< T > p_reference)
 
 ReferenceOrValue (T p_value=T())
 
void MakeReference (T &p_reference)
 
void MakeValue (T p_value=T())
 
 operator T ()
 
ReferenceOrValue< T > & operator= (T p_value)
 
Get () const
 
void Set (T p_value)
 

Detailed Description

template<typename T>
class OvTools::Utils::ReferenceOrValue< T >

A simple class that can represent a reference or a value of the given type. The usage of the data is the same for both usages. The goal is to be able to instanciate objects that can be a reference or a value without taking care of what it is.

Constructor & Destructor Documentation

◆ ReferenceOrValue() [1/2]

template<typename T >
OvTools::Utils::ReferenceOrValue< T >::ReferenceOrValue ( std::reference_wrapper< T >  p_reference)
inline

Construct the ReferenceOrValue instance with a reference

Parameters
p_reference

◆ ReferenceOrValue() [2/2]

template<typename T >
OvTools::Utils::ReferenceOrValue< T >::ReferenceOrValue ( p_value = T())
inline

Construct the ReferenceOrValue instance with a value

Parameters
p_value

Member Function Documentation

◆ Get()

template<typename T >
T OvTools::Utils::ReferenceOrValue< T >::Get ( ) const
inline

Returns the value (From reference or directly from the value)

◆ MakeReference()

template<typename T >
void OvTools::Utils::ReferenceOrValue< T >::MakeReference ( T &  p_reference)
inline

Make the ReferenceOrValue a reference

Parameters
p_reference

◆ MakeValue()

template<typename T >
void OvTools::Utils::ReferenceOrValue< T >::MakeValue ( p_value = T())
inline

Make the ReferenceOrValue a value

Parameters
p_value

◆ operator T()

template<typename T >
OvTools::Utils::ReferenceOrValue< T >::operator T ( )
inline

Implicit conversion of a ReferenceOrValue to a T

◆ operator=()

template<typename T >
ReferenceOrValue<T>& OvTools::Utils::ReferenceOrValue< T >::operator= ( p_value)
inline

Assignment operator thats call the setter of the ReferenceOrValue instance

Parameters
p_value

◆ Set()

template<typename T >
void OvTools::Utils::ReferenceOrValue< T >::Set ( p_value)
inline

Sets the value (To the reference or directly to the value)

Parameters
p_value

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