Namespaces
Variants

std::experimental::optional<T>::emplace

From cppreference.com
Revision as of 01:39, 17 March 2014 by P12bot (talk | contribs) (cpp/utility/optional -> cpp/experimental/optional)
 
 
Experimental
Technical Specification
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Experimental Non-TS
Pattern Matching
Linear Algebra
std::execution
Contracts
2D Graphics
 
 
 
template< class... Args > 
void emplace( Args&&... args );
(library fundamentals TS)
template< class U, class... Args > 
void emplace( std::initializer_list<U> ilist, Args&&... args );
(library fundamentals TS)

Constructs the contained value in-place. If *this is in engaged state before the call, the contained value is destroyed by calling its destructor.

1) Initializes the contained value by calling its constructor with args... as parameters.
2) Inilializes the contained value by calling its constructor with ilist and args... as parameters.

Parameters

args... - the arguments to pass to the constructor
ilist - the initializer list to pass to the constructor
Type requirements
-
T must be constructible from Args...
-
T must be constructible from std::initializer_list and Args...

Return value

(none)

Exceptions

Any exception thrown by the selected constructor of T. If an exception is thrown, *this is in disengaged state after the call.

See also

assigns contents
(public member function) [edit]