boost::openmethod::virtual_any::virtual_any
Construct from a value.
Synopsis
Declared in <boost/openmethod/interop/virtual_any.hpp>
template<typename T>
requires !BOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCS
IsVirtualAny<std::decay_t<T>> &&
!std::is_same_v<std::decay_t<T>, Any> &&
std::is_constructible_v<Any, T&&>
virtual_any(T&& value);
Description
Stores value in the any, and sets the v‐table pointer to the registry::static_vptr for its type ‐ no hash table lookup is involved. The type of value, stripped from reference and cv‐qualifiers, is registered automatically in Registry, as a class derived from Any.
Example
// the type is known at compile time, so the v-table pointer is read
// from a static variable - there is no lookup
virtual_std_any answer = 42;
std::cout << name(answer) << "\n"; // 42 the integer
Parameters
Name |
Description |
value |
The value to store. |
Created with MrDocs