#include <Corrade/Containers/Reference.h>
template<class T>
Reference class
Lightweight nonowning reference wrapper.
Equivalent to std::operator()
and there are no equivalents to std::
This class is exclusively for lvalue references. If you want to accept rvalue references instead, use a MoveReference; if you want to accept both, use an AnyReference.
STL compatibility
Instances of Reference are implicitly convertible to and from std::#include <functional>
, which significantly affects compile times. Example:
#include <Corrade/Containers/ReferenceStl.h> … int a = 1337; Containers::Reference<int> b = a; std::reference_wrapper<int> c = b; Containers::Reference<const int> d = std::cref(a);
Public types
 using Type = T new in Git master
 Value type.
Constructors, destructors, conversion operators
 Reference(T& reference) constexpr noexcept
 Constructor.

template<class U, class = decltype(Implementation::ReferenceConverter<T, U>::from(std::Reference(U other) constexpr noexcept
declval <U>()))>  Construct a reference from external representation.
 Reference(T&&) deleted
 Construction from rvalue references is not allowed.

template<class U, class = typename std::Reference(Reference<U> other) constexpr noexcept
enable_if <std::is_base_of <T, U>::value>::type>  Construct a reference from another of a derived type.

template<class U, class = decltype(Implementation::ReferenceConverter<T, U>::to(std::operator U() const constexpr
declval <Reference<T>>()))>  Convert the reference to external representation.
 operator T&() const constexpr
 Underlying reference.
 operator Reference<const T>() const constexpr
Public functions
 auto get() const > T& constexpr
 Underlying reference.
 auto operator>() const > T* constexpr
 Access the underlying reference.
 auto operator*() const > T& constexpr
 Access the underlying reference.
Function documentation
template<class T>
template<class U, class = decltype(Implementation::ReferenceConverter<T, U>::from(std::declval <U>()))>
Corrade::Containers::Reference<T>:: Reference(U other) constexpr noexcept
Construct a reference from external representation.
template<class T>
Corrade::Containers::Reference<T>:: Reference(T&&) deleted
Construction from rvalue references is not allowed.
A MoveReference can be created from rvalue references instead.
template<class T>
template<class U, class = typename std::enable_if <std::is_base_of <T, U>::value>::type>
Corrade::Containers::Reference<T>:: Reference(Reference<U> other) constexpr noexcept
Construct a reference from another of a derived type.
Expects that T
is a base of U
.
template<class T>
template<class U, class = decltype(Implementation::ReferenceConverter<T, U>::to(std::declval <Reference<T>>()))>
Corrade::Containers::Reference<T>:: operator U() const constexpr
Convert the reference to external representation.
template<class T>
Corrade::Containers::Reference<T>:: operator Reference<const T>() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T* Corrade::Containers::Reference<T>:: operator>() const constexpr
Access the underlying reference.
template<class T>
T& Corrade::Containers::Reference<T>:: operator*() const constexpr
Access the underlying reference.
template<class T>
template<class T>
Utility::Debug & operator<<(Utility::Debug & debug,
Reference<T> value)
Debug output operator.