Loading [MathJax]/extensions/tex2jax.js
Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
fub::function_ref< Ret(Params...)> Class Template Reference

An efficient, type-erasing, non-owning reference to a callable. More...

#include <function_ref.hpp>

Public Member Functions

template<typename Callable , typename = std::enable_if_t<IsInvocable<Callable, Ret, Params...>::value>>
 function_ref (Callable &&callable, typename std::enable_if< !std::is_same< typename std::remove_reference< Callable >::type, function_ref >::value >::type *=nullptr)
 
Ret operator() (Params... params) const
 

Static Private Member Functions

template<typename Callable >
static Ret callback_fn (std::intptr_t callable, Params... params)
 

Private Attributes

Ret(* callback )(std::intptr_t callable, Params... params)
 
std::intptr_t callable
 

Detailed Description

template<typename Ret, typename... Params>
class fub::function_ref< Ret(Params...)>

An efficient, type-erasing, non-owning reference to a callable.

This is intended for use as the type of a function parameter that is not used after the function in question returns.

This class does not own the callable, so it is not in general safe to store a function_ref.

Constructor & Destructor Documentation

◆ function_ref()

template<typename Ret , typename... Params>
template<typename Callable , typename = std::enable_if_t<IsInvocable<Callable, Ret, Params...>::value>>
fub::function_ref< Ret(Params...)>::function_ref ( Callable &&  callable,
typename std::enable_if< !std::is_same< typename std::remove_reference< Callable >::type, function_ref< Ret(Params...)> >::value >::type *  = nullptr 
)
inline

Member Function Documentation

◆ callback_fn()

template<typename Ret , typename... Params>
template<typename Callable >
static Ret fub::function_ref< Ret(Params...)>::callback_fn ( std::intptr_t  callable,
Params...  params 
)
inlinestaticprivate

◆ operator()()

template<typename Ret , typename... Params>
Ret fub::function_ref< Ret(Params...)>::operator() ( Params...  params) const
inline

Member Data Documentation

◆ callable

template<typename Ret , typename... Params>
std::intptr_t fub::function_ref< Ret(Params...)>::callable
private

◆ callback

template<typename Ret , typename... Params>
Ret(* fub::function_ref< Ret(Params...)>::callback) (std::intptr_t callable, Params... params)
private

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