ΒΆtemplate <class T>
inline constexpr T take(T& t) noexcept
template <class T>
inline constexpr T take(T& t) noexcept
Description
Moves from `t` and constructs a new `T` in its place. Returns the old value of `t`. Requires that the type is `final` because calling take() on a base class could lead to Undefined Behaviour if the now-reconstructed object is accessed without std::launder thereafter, as replacing a subclass with the base class would change the underlying storage.
Declared at: sus/mem/take.h:38
Templates
- T
Parameters
- T& t