Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::delegate< TReturn(TArgs...)> Class Template Referencefinal

Specialisation. More...

#include <delegate_cpp11.h>

Public Types

using return_type = TReturn
using argument_types = etl::type_list<TArgs...>

Public Member Functions

ETL_CONSTEXPR14 delegate () ETL_NOEXCEPT
 Default constructor.
ETL_CONSTEXPR14 delegate (const delegate &other)=default
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
ETL_CONSTEXPR14 delegate (TLambda &instance) ETL_NOEXCEPT
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
ETL_CONSTEXPR14 delegate (const TLambda &instance) ETL_NOEXCEPT
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !etl::is_same<etl::delegate<TReturn(TArgs...)>, TLambda>::value, void>>
ETL_CONSTEXPR14 delegate (TLambda &&instance)=delete
template<TReturn(*)(TArgs...) Method>
ETL_CONSTEXPR14 void set () ETL_NOEXCEPT
 Set from function (Compile time).
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
ETL_CONSTEXPR14 void set (TLambda &instance) ETL_NOEXCEPT
 Set from Lambda or Functor.
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
ETL_CONSTEXPR14 void set (const TLambda &instance) ETL_NOEXCEPT
 Set from const Lambda or Functor.
template<typename T, TReturn(T::*)(TArgs...) Method>
ETL_CONSTEXPR14 void set (T &instance) ETL_NOEXCEPT
 Set from instance method (Run time).
template<typename T, TReturn(T::*)(TArgs...) const Method>
ETL_CONSTEXPR14 void set (T &instance) ETL_NOEXCEPT
 Set from const instance method (Run time).
template<typename T, T & Instance, TReturn(T::*)(TArgs...) Method>
ETL_CONSTEXPR14 void set () ETL_NOEXCEPT
 Set from instance method (Compile time).
template<typename T, TReturn(T::*)(TArgs...) Method, T & Instance>
ETL_CONSTEXPR14 void set () ETL_NOEXCEPT
template<typename T, T const & Instance, TReturn(T::*)(TArgs...) const Method>
ETL_CONSTEXPR14 void set () ETL_NOEXCEPT
 Set from const instance method (Compile time).
template<typename T, TReturn(T::*)(TArgs...) const Method, T const & Instance>
ETL_CONSTEXPR14 void set () ETL_NOEXCEPT
ETL_CONSTEXPR14 void clear () ETL_NOEXCEPT
 Clear the delegate.
template<typename... TCallArgs>
ETL_CONSTEXPR14 return_type operator() (TCallArgs &&... args) const
 Execute the delegate.
template<typename TRet = TReturn, typename... TCallArgs>
ETL_CONSTEXPR14 etl::enable_if_t< etl::is_same< TRet, void >::value, bool > call_if (TCallArgs &&... args) const
template<typename TRet = TReturn, typename... TCallArgs>
ETL_CONSTEXPR14 etl::enable_if_t<!etl::is_same< TRet, void >::value, etl::optional< TReturn > > call_if (TCallArgs &&... args) const
template<typename TAlternative, typename... TCallArgs>
ETL_CONSTEXPR14 TReturn call_or (TAlternative &&alternative, TCallArgs &&... args) const
template<TReturn(*)(TArgs...) Method, typename... TCallArgs>
ETL_CONSTEXPR14 TReturn call_or (TCallArgs &&... args) const
delegateoperator= (const delegate &rhs)=default
 Assignment.
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
ETL_CONSTEXPR14 delegateoperator= (TLambda &instance) ETL_NOEXCEPT
 Create from Lambda or Functor.
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
ETL_CONSTEXPR14 delegateoperator= (const TLambda &instance) ETL_NOEXCEPT
 Create from const Lambda or Functor.
ETL_NODISCARD ETL_CONSTEXPR14 bool operator== (const delegate &rhs) const ETL_NOEXCEPT
 Checks equality.
ETL_CONSTEXPR14 bool operator!= (const delegate &rhs) const ETL_NOEXCEPT
 Returns true if the delegate is valid.
ETL_NODISCARD ETL_CONSTEXPR14 bool is_valid () const ETL_NOEXCEPT
 Returns true if the delegate is valid.
ETL_NODISCARD ETL_CONSTEXPR14 operator bool () const ETL_NOEXCEPT
 Returns true if the delegate is valid.

Static Public Member Functions

template<TReturn(*)(TArgs...) Method>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create () ETL_NOEXCEPT
 Create from function (Compile time).
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create (TLambda &instance) ETL_NOEXCEPT
 Create from Lambda or Functor.
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !is_delegate<TLambda>::value, void>>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create (const TLambda &instance) ETL_NOEXCEPT
 Create from const Lambda or Functor.
template<typename T, TReturn(T::*)(TArgs...) Method>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create (T &instance) ETL_NOEXCEPT
 Create from instance method (Run time).
template<typename T, TReturn(T::*)(TArgs...) Method>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create (T &&instance)=delete
template<typename T, TReturn(T::*)(TArgs...) const Method>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create (const T &instance) ETL_NOEXCEPT
 Create from const instance method (Run time).
template<typename T, TReturn(T::*)(TArgs...) const Method>
static ETL_CONSTEXPR14 delegate create (T &&instance)=delete
 Disable create from rvalue instance method (Run time).
template<typename T, T & Instance, TReturn(T::*)(TArgs...) Method>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create () ETL_NOEXCEPT
 Create from instance method (Compile time).
template<typename T, TReturn(T::*)(TArgs...) Method, T & Instance>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create () ETL_NOEXCEPT
template<typename T, T const & Instance, TReturn(T::*)(TArgs...) const Method>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create () ETL_NOEXCEPT
 Create from const instance method (Compile time).
template<typename T, TReturn(T::*)(TArgs...) const Method, T const & Instance>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create () ETL_NOEXCEPT
template<typename T, T & Instance>
static ETL_NODISCARD ETL_CONSTEXPR14 delegate create () ETL_NOEXCEPT

Detailed Description

template<typename TReturn, typename... TArgs>
class etl::delegate< TReturn(TArgs...)>

Specialisation.

Member Function Documentation

◆ call_if() [1/2]

template<typename TReturn, typename... TArgs>
template<typename TRet = TReturn, typename... TCallArgs>
ETL_CONSTEXPR14 etl::enable_if_t<!etl::is_same< TRet, void >::value, etl::optional< TReturn > > etl::delegate< TReturn(TArgs...)>::call_if ( TCallArgs &&... args) const
inline

Execute the delegate if valid. Non 'void' return delegate.

◆ call_if() [2/2]

template<typename TReturn, typename... TArgs>
template<typename TRet = TReturn, typename... TCallArgs>
ETL_CONSTEXPR14 etl::enable_if_t< etl::is_same< TRet, void >::value, bool > etl::delegate< TReturn(TArgs...)>::call_if ( TCallArgs &&... args) const
inline

Execute the delegate if valid. 'void' return delegate.

◆ call_or() [1/2]

template<typename TReturn, typename... TArgs>
template<typename TAlternative, typename... TCallArgs>
ETL_CONSTEXPR14 TReturn etl::delegate< TReturn(TArgs...)>::call_or ( TAlternative && alternative,
TCallArgs &&... args ) const
inline

Execute the delegate if valid or call alternative. Run time alternative.

◆ call_or() [2/2]

template<typename TReturn, typename... TArgs>
template<TReturn(*)(TArgs...) Method, typename... TCallArgs>
ETL_CONSTEXPR14 TReturn etl::delegate< TReturn(TArgs...)>::call_or ( TCallArgs &&... args) const
inline

Execute the delegate if valid or call alternative. Compile time alternative.

◆ create() [1/4]

template<typename TReturn, typename... TArgs>
template<typename T, T & Instance>
ETL_NODISCARD ETL_CONSTEXPR14 delegate etl::delegate< TReturn(TArgs...)>::create ( )
inlinestatic

Create from instance function operator (Compile time). At the time of writing, GCC appears to have trouble with this.

◆ create() [2/4]

template<typename TReturn, typename... TArgs>
template<typename T, TReturn(T::*)(TArgs...) const Method, T const & Instance>
ETL_NODISCARD ETL_CONSTEXPR14 delegate etl::delegate< TReturn(TArgs...)>::create ( )
inlinestatic

Create from const instance method (Compile time). New API

◆ create() [3/4]

template<typename TReturn, typename... TArgs>
template<typename T, TReturn(T::*)(TArgs...) Method, T & Instance>
ETL_NODISCARD ETL_CONSTEXPR14 delegate etl::delegate< TReturn(TArgs...)>::create ( )
inlinestatic

Create from instance method (Compile time). New API

◆ create() [4/4]

template<typename TReturn, typename... TArgs>
template<typename T, TReturn(T::*)(TArgs...) Method>
ETL_NODISCARD ETL_CONSTEXPR14 delegate etl::delegate< TReturn(TArgs...)>::create ( T && instance)
staticdelete

Create from instance method (Run time). Deleted for rvalue references.

◆ set() [1/2]

template<typename TReturn, typename... TArgs>
template<typename T, TReturn(T::*)(TArgs...) const Method, T const & Instance>
ETL_CONSTEXPR14 void etl::delegate< TReturn(TArgs...)>::set ( )
inline

Set from const instance method (Compile time). New API

◆ set() [2/2]

template<typename TReturn, typename... TArgs>
template<typename T, TReturn(T::*)(TArgs...) Method, T & Instance>
ETL_CONSTEXPR14 void etl::delegate< TReturn(TArgs...)>::set ( )
inline

Set from instance method (Compile time). New API


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