This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
optional<T&>::emplace
Section: 22.5.4.3 [optional.ref.assign] Status: New Submitter: Giuseppe D'Angelo Opened: 2025-07-15 Last modified: 2025-07-26
Priority: Not Prioritized
View all issues with New status.
Discussion:
The specification for optional<T&>::emplace
in 22.5.4.3 [optional.ref.assign]
is not specifying the returned value via a Returns: element; however the
function does indeed return something (a T&
). Such a Returns: element is there
for the primary template's emplace
(cf. 22.5.3.4 [optional.assign]).
Proposed resolution:
This wording is relative to this CD preview draft.
Modify 22.5.4.3 [optional.ref.assign] as indicated:
template<class U> constexpr T& emplace(U&& u) noexcept(is_nothrow_constructible_v<T&, U>);-4- Constraints: […]
-5- Effects: Equivalent to:convert-ref-init-val(std::forward<U>(u))
. -?- Returns:*val
.