boost::openmethod::virtual_any::emplace

Construct a value in place.

Synopsis

Declared in <boost/openmethod/interop/virtual_any.hpp>

template<
    class Class,
    typename... T>
void
emplace(T&&... args);

Description

Stores a Class constructed from args, and sets the v‐table pointer to the registry::static_vptr for Class ‐ no hash table lookup is involved. Class is registered automatically in Registry, as a class derived from Any.

Example

virtual_std_any value;

value.emplace<std::string>("Felix the cat");

std::cout << name(value) << "\n"; // Felix the cat

Template Parameters

Name

Description

Class

The type of the value to construct.

T

Types of the arguments to pass to the constructor.

Parameters

Name

Description

args

Arguments to pass to the constructor of Class.

Created with MrDocs