BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IFactory.h File Reference

Description

Defines interface class IFactory.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file IFactory.h.

Include dependency graph for IFactory.h:

Go to the source code of this file.

Classes

class  IFactory< Key, AbstractProduct >
 Base class for all factories. More...
 

Functions

template<class T >
T * create_new ()
 Returns new instance of class T. More...
 

Function Documentation

◆ create_new()

template<class T >
T* create_new ( )

Returns new instance of class T.

This templated function is used in catalogs in form of a function pointer 'create_new<T>', with no function arguments supplied. Equivalently, we could use a lambda function '[](){return new T;}'.

Definition at line 76 of file IFactory.h.

77 {
78  return new T();
79 }