template< class T, class... Args >
T& emplace( Args&&... args );
Creates a new value in-place, in an existing variant
object
Equivalent to
emplace<I>(std::forward<Args>(args)...), where
I
is the zero-based index of
T
in
Types...
.
T
occurs exactly once in Types...
.Equivalent to
emplace<I>(il, std::forward<Args>(args)...), where
I
is the zero-based index of
T
in
Types...
.
T
occurs exactly once in Types...
.First, destroys the currently contained value (if any). Then
direct-initializesthe contained value as if constructing a value of type
T_I
with the arguments
std::forward<Args>(args).... If an exception is thrown,
*thismay become
valueless_by_exception
.
I
is not less than sizeof...(Types).A reference to the new contained value.
[edit] Exceptions1-4) Any exception thrown during the initialization of the contained value.
[edit] Notes [edit] Example [edit] Defect reportsThe following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior P2231R1 C++20emplace
was not constexpr while the required operations can be constexpr in C++20 made constexpr [edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4