Gamedev Framework (gf)  0.12.0
A C++14 framework for 2D games
Public Member Functions | Related Functions | List of all members
gf::Ref< T > Class Template Reference

A reference wrapper. More...

#include <gf/Ref.h>

Public Member Functions

 Ref (T &ref) noexcept
 Constructor with a lvalue reference. More...
 
 Ref (T &&)=delete
 Deleted constructor with rvalue reference. More...
 
 Ref (const Ref &other) noexcept=default
 Copy constructor. More...
 
Refoperator= (const Ref &other) noexcept=default
 Copy assignment. More...
 
Tget () const noexcept
 Get the reference. More...
 
 operator T & () const noexcept
 Conversion to a reference. More...
 

Related Functions

(Note that these are not member functions.)

template<typename T >
constexpr bool operator== (Ref< T > lhs, Ref< T > rhs) noexcept
 Referece comparison. More...
 
template<typename T >
constexpr bool operator== (Ref< T > lhs, const T &rhs) noexcept
 Referece comparison. More...
 
template<typename T >
constexpr bool operator== (const T &lhs, Ref< T > rhs) noexcept
 Referece comparison. More...
 

Detailed Description

template<typename T>
class gf::Ref< T >

A reference wrapper.

This class is similar to std::reference_wrapper.

Constructor & Destructor Documentation

◆ Ref() [1/3]

template<typename T>
gf::Ref< T >::Ref ( T ref)
inlinenoexcept

Constructor with a lvalue reference.

Parameters
refA reference

◆ Ref() [2/3]

template<typename T>
gf::Ref< T >::Ref ( T &&  )
delete

Deleted constructor with rvalue reference.

◆ Ref() [3/3]

template<typename T>
gf::Ref< T >::Ref ( const Ref< T > &  other)
defaultnoexcept

Copy constructor.

Member Function Documentation

◆ get()

template<typename T>
T& gf::Ref< T >::get ( ) const
inlinenoexcept

Get the reference.

Returns
A reference to the object

◆ operator T &()

template<typename T>
gf::Ref< T >::operator T& ( ) const
inlinenoexcept

Conversion to a reference.

Returns
A reference to the object

◆ operator=()

template<typename T>
Ref& gf::Ref< T >::operator= ( const Ref< T > &  other)
defaultnoexcept

Copy assignment.

Friends And Related Function Documentation

◆ operator==() [1/3]

template<typename T >
constexpr bool operator== ( Ref< T lhs,
Ref< T rhs 
)
related

Referece comparison.

The reference are compared by address, not by value.

◆ operator==() [2/3]

template<typename T >
constexpr bool operator== ( Ref< T lhs,
const T rhs 
)
related

Referece comparison.

The reference are compared by address, not by value.

◆ operator==() [3/3]

template<typename T >
constexpr bool operator== ( const T lhs,
Ref< T rhs 
)
related

Referece comparison.

The reference are compared by address, not by value.