Namespaces
Variants
Actions

std::any::emplace

From cppreference.com
< cpp‎ | utility‎ | any
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
template< class ValueType, class... Args >
std::decay_t<ValueType>& emplace( Args&&... args );
(1) (since C++17)
template< class ValueType, class U, class... Args >
std::decay_t<ValueType>& emplace( std::initializer_list<U> il, Args&&... args );
(2) (since C++17)

Changes the contained object to one of type std::decay_t<ValueType> constructed from the arguments.

First destroys the current contained object (if any) by reset(), then:

1) constructs an object of type std::decay_t<ValueType>, direct-non-list-initialized from std::forward<Args>(args)..., as the contained object.
2) constructs an object of type std::decay_t<ValueType>, direct-non-list-initialized from il, std::forward<Args>(args)..., as the contained object.

Contents

[edit] Template parameters

ValueType - contained value type
Type requirements
-
std::decay_t<ValueType> must meet the requirements of CopyConstructible.

[