template<class T>
Corrade::Containers::MoveReference class new in Git master

Lightweight non-owning r-value reference wrapper.

Counterpart to a Reference that accepts r-value references. The main use case is to store r-value references in a container — for example when an API needs to take a list of instances to take over ownership of. Use in a constexpr context is not envisioned for this class and so compared to a Reference the class is not constexpr.

This class is exclusively for r-value references. If you want to accept only l-value references, use a Reference; if you want to accept both, use an AnyReference.

Unlike a Reference, which corresponds to a std::reference_wrapper, this class doesn't have a STL equivalent. For that reason there's also no interface to do a conversion from/to an external representation.

Public types

using Type = T new in Git master
Value type.

Constructors, destructors, conversion operators

MoveReference(T&& reference) noexcept
Constructor.
MoveReference(T&) deleted
Construction from l-value references is not allowed.
template<class U, class = typename std::enable_if<std::is_base_of<T, U>::value>::type>
MoveReference(MoveReference<U> other) noexcept
Construct a reference from another of a derived type.
operator T&() const
Underlying reference.

Public functions

auto get() const -> T&
Underlying reference.
auto operator->() const -> T*
Access the underlying reference.
auto operator*() const -> T&
Access the underlying reference.

Function documentation

template<class T>
Corrade::Containers::MoveReference<T>::MoveReference(T&) deleted

Construction from l-value references is not allowed.

A Reference can be created from l-value references instead.

template<class T> template<class U, class = typename std::enable_if<std::is_base_of<T, U>::value>::type>
Corrade::Containers::MoveReference<T>::MoveReference(MoveReference<U> other) noexcept

Construct a reference from another of a derived type.

Expects that T is a base of U.

template<class T>
T* Corrade::Containers::MoveReference<T>::operator->() const

Access the underlying reference.

get(), operator*()

template<class T>
T& Corrade::Containers::MoveReference<T>::operator*() const

Access the underlying reference.

template<class T> template<class T>
Utility::Debug& operator<<(Utility::Debug& debug, MoveReference<T> value)

Debug output operator.