Tomographer  v2.0
Tomographer C++ Framework Documentation
Tomographer::Tools::NeedOwnOperatorNew< Types > Struct Template Reference

Provide appropriate operator new() definitions for a structure which has a member of the given stored types. More...

#include <tomographer2/tools/needownoperatornew.h>

Detailed Description

template<typename... Types>
struct Tomographer::Tools::NeedOwnOperatorNew< Types >

Provide appropriate operator new() definitions for a structure which has a member of the given stored types.

Some types require a specific implementation of operator new(), such as Eigen (see this page). Hence, if a class has an Eigen member, it needs to make sure to have the appropriate implementations of operator new().

Because in our generic classes, we may be requried to store types (as members), such as a PointType in a random walk, and we can't assume it will be an Eigen object. The solution is that those objects inherit NeedOwnOperatorNew<PointType>::ProviderType, such that proper operator-new definitions can be generated by appropriate specializations of NeedOwnOperatorNew.

The template arguments are a list of types, which could potentially require having appropriate operator new() implementations if such a type is a class member. Just inherit NeedOwnOperatorNew<Type1, Type2, ...>::ProviderType and (provided the types don't have conflicting requirements for special operator-new implementations) the correct implementation of operator-new (if any is required) will be used automatically.

Defining special operator-new requirments for a specific type

If a specific type T needs a particular operator-new requirement (such as Eigen types), the first thing to do is define the corresponding OperatorNewProviderType. The latter type should adhere to the pageInterfaceOperatorNewProviderType.

Definition at line 115 of file needownoperatornew.h.


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