AnyReference class new in Git master
Lightweight non-owning l-value and r-value reference wrapper.
Combination of a Reference and MoveReference that accepts both l-value and r-value references. The main use case is for APIs that take a list of instances to optionally take over the ownership of — each instance remembers whether a l-value or a r-value reference was used to construct it and exposes that through isRvalue().
Like with MoveReference, use in a
constexpr context is not envisioned for this class and so the API is not
constexpr. There's no STL equivalent and thus no conversion interface from/to an external representation exists either.
- AnyReference(T& reference) noexcept
- Construct from a l-value.
- AnyReference(T&& reference) noexcept
- Construct from a r-value.
- AnyReference(AnyReference<U> other) noexcept
- Construct a reference from another of a derived type.
- operator T&() const
- Underlying reference.
- operator AnyReference<const T>() const
template<class U, class = typename std::
enable_if<std:: is_base_of<T, U>::value>::type>
Corrade:: Containers:: AnyReference<T>:: AnyReference(AnyReference<U> other) noexcept
Construct a reference from another of a derived type.
T is a base of
U. The isRvalue() state is copied from
Containers:: AnyReference<T>:: operator AnyReference<const T>() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: AnyReference<T>:: operator*() const
Access the underlying reference.