siplasplas
A library for C++ reflection and introspection
cpp::UniversalReference< T, IsLvalueReference, IsConst > Class Template Reference

Implements a copyable wrapper of an universal reference. More...

#include <siplasplas/utility/universal_reference.hpp>

Public Types

using ValueType = T
 

Public Member Functions

 UniversalReference (const ValueType &lvalueRef)
 
const ValueType & get () const
 Returns a read only reference to the referenced object.
 

Detailed Description

template<typename T, bool IsLvalueReference, bool IsConst>
class cpp::UniversalReference< T, IsLvalueReference, IsConst >

Implements a copyable wrapper of an universal reference.

This template and its specialization provides a common interface to store references to lvalue and rvalues. UniversalReference has different spacializations for each value category supported (reference to lvalue, const reference to lvalue, rvalue). Instances of this types should be created through cpp::universalReference() function, which instances the appropiate template given the input value category.

If the input value is an lvalue (i.e. the function parameter is a reference to an lvalue), UniversalReference specialization wrapping the reference is chosen. If the input value is an rvalue (the function parameter is a reference to an rvalue), the value is moved into the UniversalReference object and owned by it.

This main template is the specialization for const lvalues


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