scc 2025.09
SystemC components library
util::delegate< R(A...)> Class Template Reference

A fast alternative to std::function with improved performance. More...

#include <delegate.h>

Public Types

template<class C>
using member_pair = ::std::pair<C* const, R (C::*const)(A...)>
template<class C>
using const_member_pair = ::std::pair<C const* const, R (C::*const)(A...) const>

Public Member Functions

 delegate (delegate const &)=default
 delegate (delegate &&)=default
 delegate (::std::nullptr_t const) noexcept
template<class C, typename = typename ::std::enable_if<::std::is_class<C>{}>::type>
 delegate (C const *const o) noexcept
template<class C, typename = typename ::std::enable_if<::std::is_class<C>{}>::type>
 delegate (C const &o) noexcept
template<class C>
 delegate (C *const object_ptr, R(C::*const method_ptr)(A...))
template<class C>
 delegate (C *const object_ptr, R(C::*const method_ptr)(A...) const)
template<class C>
 delegate (C &object, R(C::*const method_ptr)(A...))
template<class C>
 delegate (C const &object, R(C::*const method_ptr)(A...) const)
template<typename T, typename = typename ::std::enable_if<!::std::is_same<delegate, typename ::std::decay<T>::type>{}>::type>
 delegate (T &&f)
delegate & operator= (delegate const &)=default
delegate & operator= (delegate &&)=default
template<class C>
delegate & operator= (R(C::*const rhs)(A...))
template<class C>
delegate & operator= (R(C::*const rhs)(A...) const)
template<typename T, typename = typename ::std::enable_if<!::std::is_same<delegate, typename ::std::decay<T>::type>{}>::type>
delegate & operator= (T &&f)
void reset ()
void reset_stub () noexcept
void swap (delegate &other) noexcept
bool operator== (delegate const &rhs) const noexcept
bool operator!= (delegate const &rhs) const noexcept
bool operator< (delegate const &rhs) const noexcept
bool operator== (::std::nullptr_t const) const noexcept
bool operator!= (::std::nullptr_t const) const noexcept
 operator bool () const noexcept
operator() (A... args) const

Static Public Member Functions

template<R(*)(A...) function_ptr>
static delegate from () noexcept
template<class C, R(C::*)(A...) method_ptr>
static delegate from (C *const object_ptr) noexcept
template<class C, R(C::*)(A...) const method_ptr>
static delegate from (C const *const object_ptr) noexcept
template<class C, R(C::*)(A...) method_ptr>
static delegate from (C &object) noexcept
template<class C, R(C::*)(A...) const method_ptr>
static delegate from (C const &object) noexcept
template<typename T>
static delegate from (T &&f)
static delegate from (R(*const function_ptr)(A...))
template<class C>
static delegate from (C *const object_ptr, R(C::*const method_ptr)(A...))
template<class C>
static delegate from (C const *const object_ptr, R(C::*const method_ptr)(A...) const)
template<class C>
static delegate from (C &object, R(C::*const method_ptr)(A...))
template<class C>
static delegate from (C const &object, R(C::*const method_ptr)(A...) const)

Friends

struct ::std::hash< delegate >

Detailed Description

template<class R, class... A>
class util::delegate< R(A...)>

A fast alternative to std::function with improved performance.

The delegate class is a template class that allows to call functions, member functions, and lambda expressions as delegates. It does not provide ownership handling and lifetime management. The using function needs to make sure that the object and method pointers are valid.

Template Parameters
RThe return type of the delegate.
AThe argument types of the delegate.

Definition at line 49 of file delegate.h.

Member Typedef Documentation

◆ const_member_pair

template<class R, class... A>
template<class C>
using util::delegate< R(A...)>::const_member_pair = ::std::pair<C const* const, R (C::*const)(A...) const>

Definition at line 152 of file delegate.h.

◆ member_pair

template<class R, class... A>
template<class C>
using util::delegate< R(A...)>::member_pair = ::std::pair<C* const, R (C::*const)(A...)>

Definition at line 150 of file delegate.h.

Constructor & Destructor Documentation

◆ delegate() [1/8]

template<class R, class... A>
util::delegate< R(A...)>::delegate ( ::std::nullptr_t const )
inlinenoexcept

Definition at line 63 of file delegate.h.

◆ delegate() [2/8]

template<class R, class... A>
template<class C, typename = typename ::std::enable_if<::std::is_class<C>{}>::type>
util::delegate< R(A...)>::delegate ( C const *const o)
inlineexplicitnoexcept

Definition at line 67 of file delegate.h.

◆ delegate() [3/8]

template<class R, class... A>
template<class C, typename = typename ::std::enable_if<::std::is_class<C>{}>::type>
util::delegate< R(A...)>::delegate ( C const & o)
inlineexplicitnoexcept

Definition at line 71 of file delegate.h.

◆ delegate() [4/8]

template<class R, class... A>
template<class C>
util::delegate< R(A...)>::delegate ( C *const object_ptr,
R(C::* method_ptr )(A...) )
inline

Definition at line 74 of file delegate.h.

◆ delegate() [5/8]

template<class R, class... A>
template<class C>
util::delegate< R(A...)>::delegate ( C *const object_ptr,
R(C::* method_ptr )(A...) const )
inline

Definition at line 76 of file delegate.h.

◆ delegate() [6/8]

template<class R, class... A>
template<class C>
util::delegate< R(A...)>::delegate ( C & object,
R(C::* method_ptr )(A...) )
inline

Definition at line 78 of file delegate.h.

◆ delegate() [7/8]

template<class R, class... A>
template<class C>
util::delegate< R(A...)>::delegate ( C const & object,
R(C::* method_ptr )(A...) const )
inline

Definition at line 80 of file delegate.h.

◆ delegate() [8/8]

template<class R, class... A>
template<typename T, typename = typename ::std::enable_if<!::std::is_same<delegate, typename ::std::decay<T>::type>{}>::type>
util::delegate< R(A...)>::delegate ( T && f)
inline

Definition at line 83 of file delegate.h.

Member Function Documentation

◆ from() [1/11]

template<class R, class... A>
template<R(*)(A...) function_ptr>
delegate util::delegate< R(A...)>::from ( )
inlinestaticnoexcept

Definition at line 128 of file delegate.h.

◆ from() [2/11]

template<class R, class... A>
template<class C, R(C::*)(A...) method_ptr>
delegate util::delegate< R(A...)>::from ( C & object)
inlinestaticnoexcept

Definition at line 138 of file delegate.h.

◆ from() [3/11]

template<class R, class... A>
template<class C>
delegate util::delegate< R(A...)>::from ( C & object,
R(C::* method_ptr )(A...) )
inlinestatic

Definition at line 162 of file delegate.h.

◆ from() [4/11]

template<class R, class... A>
template<class C, R(C::*)(A...) method_ptr>
delegate util::delegate< R(A...)>::from ( C *const object_ptr)
inlinestaticnoexcept

Definition at line 130 of file delegate.h.

◆ from() [5/11]

template<class R, class... A>
template<class C>
delegate util::delegate< R(A...)>::from ( C *const object_ptr,
R(C::* method_ptr )(A...) )
inlinestatic

Definition at line 154 of file delegate.h.

◆ from() [6/11]

template<class R, class... A>
template<class C, R(C::*)(A...) const method_ptr>
delegate util::delegate< R(A...)>::from ( C const & object)
inlinestaticnoexcept

Definition at line 142 of file delegate.h.

◆ from() [7/11]

template<class R, class... A>
template<class C>
delegate util::delegate< R(A...)>::from ( C const & object,
R(C::* method_ptr )(A...) const )
inlinestatic

Definition at line 164 of file delegate.h.

◆ from() [8/11]

template<class R, class... A>
template<class C, R(C::*)(A...) const method_ptr>
delegate util::delegate< R(A...)>::from ( C const *const object_ptr)
inlinestaticnoexcept

Definition at line 134 of file delegate.h.

◆ from() [9/11]

template<class R, class... A>
template<class C>
delegate util::delegate< R(A...)>::from ( C const *const object_ptr,
R(C::* method_ptr )(A...) const )
inlinestatic

Definition at line 158 of file delegate.h.

◆ from() [10/11]

template<class R, class... A>
delegate util::delegate< R(A...)>::from ( R(* function_ptr )(A...))
inlinestatic

Definition at line 148 of file delegate.h.

◆ from() [11/11]

template<class R, class... A>
template<typename T>
delegate util::delegate< R(A...)>::from ( T && f)
inlinestatic

Definition at line 146 of file delegate.h.

◆ operator bool()

template<class R, class... A>
util::delegate< R(A...)>::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 189 of file delegate.h.

◆ operator!=() [1/2]

template<class R, class... A>
bool util::delegate< R(A...)>::operator!= ( ::std::nullptr_t const ) const
inlinenoexcept

Definition at line 187 of file delegate.h.

◆ operator!=() [2/2]

template<class R, class... A>
bool util::delegate< R(A...)>::operator!= ( delegate< R(A...)> const & rhs) const
inlinenoexcept

Definition at line 179 of file delegate.h.

◆ operator()()

template<class R, class... A>
R util::delegate< R(A...)>::operator() ( A... args) const
inline

Definition at line 191 of file delegate.h.

◆ operator<()

template<class R, class... A>
bool util::delegate< R(A...)>::operator< ( delegate< R(A...)> const & rhs) const
inlinenoexcept

Definition at line 181 of file delegate.h.

◆ operator=() [1/3]

template<class R, class... A>
template<class C>
delegate & util::delegate< R(A...)>::operator= ( R(C::* rhs )(A...) const)
inline

Definition at line 103 of file delegate.h.

◆ operator=() [2/3]

template<class R, class... A>
template<class C>
delegate & util::delegate< R(A...)>::operator= ( R(C::* rhs )(A...))
inline

Definition at line 101 of file delegate.h.

◆ operator=() [3/3]

template<class R, class... A>
template<typename T, typename = typename ::std::enable_if<!::std::is_same<delegate, typename ::std::decay<T>::type>{}>::type>
delegate & util::delegate< R(A...)>::operator= ( T && f)
inline

Definition at line 106 of file delegate.h.

◆ operator==() [1/2]

template<class R, class... A>
bool util::delegate< R(A...)>::operator== ( ::std::nullptr_t const ) const
inlinenoexcept

Definition at line 185 of file delegate.h.

◆ operator==() [2/2]

template<class R, class... A>
bool util::delegate< R(A...)>::operator== ( delegate< R(A...)> const & rhs) const
inlinenoexcept

Definition at line 177 of file delegate.h.

◆ reset()

template<class R, class... A>
void util::delegate< R(A...)>::reset ( )
inline

Definition at line 168 of file delegate.h.

◆ reset_stub()

template<class R, class... A>
void util::delegate< R(A...)>::reset_stub ( )
inlinenoexcept

Definition at line 173 of file delegate.h.

◆ swap()

template<class R, class... A>
void util::delegate< R(A...)>::swap ( delegate< R(A...)> & other)
inlinenoexcept

Definition at line 175 of file delegate.h.

◆ ::std::hash< delegate >

template<class R, class... A>
friend struct ::std::hash< delegate >
friend

Definition at line 191 of file delegate.h.


The documentation for this class was generated from the following file:
  • /home/eyck/Projects/MINRES/SystemC-Components/src/common/util/delegate.h