Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

template<class T>
class ROOT::Math::ParamFunctorTempl< T >

Param Functor class for Multidimensional functions.

It is used to wrap in a very simple and convenient way any other C++ callable object (implementation double operator( const double *, const double * ) ) or a member function with the correct signature, like Foo::EvalPar(const double *, const double *)

Definition at line 38 of file ParamFunctor.h.

Public Types

using EvalType = T
 
using Signature = T(const T *, const double *)
 The signature every wrapped callable is normalized to.
 

Public Member Functions

 ParamFunctorTempl ()=default
 
template<typename Func , typename = std::enable_if_t<!std::is_same_v<std::decay_t<Func>, ParamFunctorTempl> && !std::is_same_v<std::decay_t<Func>, std::function<Signature>>>>
 ParamFunctorTempl (Func &&f)
 Construct from any callable object, or from a pointer to one.
 
template<class Obj , typename MemFn >
 ParamFunctorTempl (Obj *p, MemFn memFn)
 Construct from a pointer to a class object and a pointer to one of its member functions, like Foo::EvalPar(const double *x, const double *p).
 
 ParamFunctorTempl (std::function< Signature > f)
 Implicit conversion, relied on by the Python interface when passing a callable to TF1.
 
bool Empty () const
 
operator() (const T *x, const double *p) const
 

Private Attributes

std::function< SignaturefFunc
 

#include <Math/ParamFunctor.h>

Member Typedef Documentation

◆ EvalType

template<class T >
using ROOT::Math::ParamFunctorTempl< T >::EvalType = T

Definition at line 41 of file ParamFunctor.h.

◆ Signature

template<class T >
using ROOT::Math::ParamFunctorTempl< T >::Signature = T(const T *, const double *)

The signature every wrapped callable is normalized to.

Definition at line 44 of file ParamFunctor.h.

Constructor & Destructor Documentation

◆ ParamFunctorTempl() [1/4]

template<class T >
ROOT::Math::ParamFunctorTempl< T >::ParamFunctorTempl ( )
default

◆ ParamFunctorTempl() [2/4]

template<class T >
template<class Obj , typename MemFn >
ROOT::Math::ParamFunctorTempl< T >::ParamFunctorTempl ( Obj * p,
MemFn memFn )
inline

Construct from a pointer to a class object and a pointer to one of its member functions, like Foo::EvalPar(const double *x, const double *p).

Definition at line 51 of file ParamFunctor.h.

◆ ParamFunctorTempl() [3/4]

template<class T >
template<typename Func , typename = std::enable_if_t<!std::is_same_v<std::decay_t<Func>, ParamFunctorTempl> && !std::is_same_v<std::decay_t<Func>, std::function<Signature>>>>
ROOT::Math::ParamFunctorTempl< T >::ParamFunctorTempl ( Func && f)
inlineexplicit

Construct from any callable object, or from a pointer to one.

The callable is normalized to the T (const T *, const double *) signature: anything std::function accepts as-is is handed to it directly, a pointer to a callable object is called through without taking ownership of it, and callables that insist on non-const pointers (the classic T (T *x, double *p) signature) get their arguments cast for them.

The two exclusions keep this greedy forwarding reference away from overloads that a non-const lvalue would otherwise bind to it by exact match: the implicit copy constructor, which would end up wrapping a functor in itself, and the std::function conversion below, which is implicit for the Python interface and would become ill-formed via this explicit one.

Definition at line 71 of file ParamFunctor.h.

◆ ParamFunctorTempl() [4/4]

template<class T >
ROOT::Math::ParamFunctorTempl< T >::ParamFunctorTempl ( std::function< Signature > f)
inline

Implicit conversion, relied on by the Python interface when passing a callable to TF1.

Definition at line 86 of file ParamFunctor.h.

Member Function Documentation

◆ Empty()

template<class T >
bool ROOT::Math::ParamFunctorTempl< T >::Empty ( ) const
inline

Definition at line 90 of file ParamFunctor.h.

◆ operator()()

template<class T >
T ROOT::Math::ParamFunctorTempl< T >::operator() ( const T * x,
const double * p ) const
inline

Definition at line 88 of file ParamFunctor.h.

Member Data Documentation

◆ fFunc

template<class T >
std::function<Signature> ROOT::Math::ParamFunctorTempl< T >::fFunc
private

Definition at line 93 of file ParamFunctor.h.

  • math/mathcore/inc/Math/ParamFunctor.h