openMSX
|
Utility to do T* t = new T(...) More...
#include <serialize_meta.hh>
Public Member Functions | |
template<typename TUPLE > | |
std::unique_ptr< T > | operator() (TUPLE tuple) |
Utility to do T* t = new T(...)
The tricky part is that the constructor of T can have a variable number of parameters.
For example: Creator<Foo> creator; auto args = std::tuple(42, 3.14); std::unique_ptr<Foo> foo = creator(args); This is equivalent to auto foo = std::make_unique<Foo>(42, 3.14); But the former can be used in a generic context (where the number of constructor parameters is unknown).
Definition at line 29 of file serialize_meta.hh.
|
inline |
Definition at line 32 of file serialize_meta.hh.