boost::openmethod::make_unique_virtual
Create a new object and return a unique_virtual_ptr to it.
Synopsis
Declared in <boost/openmethod/interop/std_unique_ptr.hpp>
template<
class Class,
class Registry = boost::openmethod::default_registry,
typename... T>
auto
make_unique_virtual(T&&... args);
Description
Create an object using std::make_unique, and return a unique_virtual_ptr pointing to it. Since the exact class of the object is known, the virtual_ptr is created using final_virtual_ptr.
Class is not required to be a polymorphic class.
Example
unique_virtual_ptr<Animal> animal = make_unique_virtual<Dog>();
std::cout << poke(std::move(animal)) << "\n"; // bark
Return Value
A unique_virtual_ptr<Class, Registry> pointing to a newly created object of type Class.
Template Parameters
Name |
Description |
Class |
The class of the object to create. |
Registry |
A |
T |
Types of the arguments to pass to the constructor of |
See Also
Created with MrDocs