DefaultFactory< T > Struct Template Reference

CPP API: mio::DefaultFactory< T > Struct Template Reference
mio::DefaultFactory< T > Struct Template Reference

Creates an instance of T for later initialization. More...

#include <default_serialize.h>

Static Public Member Functions

static T create ()
 Creates a new instance of T. More...
 

Detailed Description

template<class T>
struct mio::DefaultFactory< T >

Creates an instance of T for later initialization.

The default implementation uses the default constructor of T, if available. If there is no default constructor, this class can be spezialized to provide the method static T create(). If there is a default constructor, but it is private, DefaultFactory<T> can be marked as friend instead.

The state of the object retured by create() is completely arbitrary, and may be invalid. Make sure to set it to a valid state before using it further.

Template Parameters
TThe type to create.

Member Function Documentation

◆ create()

template<class T >
static T mio::DefaultFactory< T >::create ( )
inlinestatic

Creates a new instance of T.