Create a t_TYPE alternative in place from args.
Synopsis
Declared in <bslstl_variant.h>
template<
class t_TYPE,
class... t_ARGS>
requires BSLSTL_VARIANT_HAS_UNIQUE_TYPE(t_TYPE) &&
std::is_constructible<t_TYPE, t_ARGS...>::value
t_TYPE&
emplace(t_ARGS&&... args);
Description
Create an object of alternative (template parameter) t_TYPE in place, direct‐initialized from the specified args, destroying any previously contained value first. Return a reference to the newly created t_TYPE object. If t_TYPE is allocator‐aware, it uses the allocator specified upon the construction of this variant object to supply memory; passing an allocator argument to this method results in two allocators being passed to the alternative constructor, resulting in a likely compilation error. If the constructor of t_TYPE exits via an exception, this object may be left in the valueless by exception state. This method participates in overload resolution only if t_TYPE designates a unique alternative and is constructible from args. For simplicity of implementation, this method differs from the standard in the following way: * constexpr is not implemented
Return Value
reference to the newly created t_TYPE object
Parameters
Name |
Description |
args |
arguments used to construct the |
Created with MrDocs