Classes | Public Member Functions | List of all members
openmsx::Creator< T > Class Template Reference

Utility to do T* t = new T(...) More...

#include <serialize_meta.hh>

Public Member Functions

template<typename TUPLE >
std::unique_ptr< T > operator() (TUPLE args)

Detailed Description

template<typename T>
class openmsx::Creator< T >

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; tuple<int, float> args = std::make_tuple(42, 3.14); std::unique_ptr<Foo> foo = creator(args); This is equivalent to auto foo = 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 30 of file serialize_meta.hh.

Member Function Documentation

◆ operator()()

template<typename T>
template<typename TUPLE >
std::unique_ptr<T> openmsx::Creator< T >::operator() ( TUPLE  args)

Definition at line 34 of file serialize_meta.hh.

The documentation for this class was generated from the following file: