beman::optional::optional<T&>::emplace

Emplaces a new value in the optional, destroying the current one if the optional is engaged.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class U>
requires (std::is_constructible_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U>)
constexpr
T&
emplace(U&& u) noexcept(std::is_nothrow_constructible_v<T &, U>);

Description

Constructs the contained value from u if it is convertible to T&.

Return Value

T&

Template Parameters

Name Description
U The type of the value to emplace.

Parameters

Name Description
u The value to emplace.

Created with MrDocs