Regina Calculation Engine
Public Types | Public Member Functions | List of all members
regina::NewFunction< Base > Struct Template Reference

A function object that creates a new object subclassed from Base, where the particular subclass is chosen according to the template argument to operator(). More...

#include <utilities/registryutils.h>

Inheritance diagram for regina::NewFunction< Base >:
regina::Returns< Base * >

Public Types

typedef Base * ReturnType
 Indicates the return type for a function object. More...
 

Public Member Functions

template<typename Info , typename... Args>
Base * operator() (Args &&... args) const
 Creates a new object of the subclass Info::Class. More...
 

Detailed Description

template<class Base>
struct regina::NewFunction< Base >

A function object that creates a new object subclassed from Base, where the particular subclass is chosen according to the template argument to operator().

The template argument to the bracket operator would typically be one of the registry helper classes, such as PacketInfo or NormalInfo.

This routine is intended for use with registry routines, such as the non-void variants of forPacket() and forCoords().

Python:\n Not present.

Member Typedef Documentation

◆ ReturnType

typedef Base * regina::Returns< Base * >::ReturnType
inherited

Indicates the return type for a function object.

Member Function Documentation

◆ operator()()

template<class Base >
template<typename Info , typename... Args>
Base* regina::NewFunction< Base >::operator() ( Args &&...  args) const
inline

Creates a new object of the subclass Info::Class.

Precondition
It is known in advance that Info::Class will be a subclass of Base.
Parameters
argsany additional arguments to pass to the Info::Class constructor. These will be copied/moved, so if you wish to pass a reference then you should wrap it in std::ref or std::cref.
Returns
a new object of the subclass Info::Class.

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

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).