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

Specialisation. More...

`#include <delegate_cpp11.h>`

## Public Types

using | return_type = TReturn
| The delegate's return type.
using | argument_types = etl::type_list<TArgs...>
| Type list of the delegate's argument types.

## Public Member Functions

ETL_CONSTEXPR14 | delegate () ETL_NOEXCEPT
| Default constructor.
ETL_CONSTEXPR14 | delegate (const delegate &other)=default
| Copy constructor.
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
| Construct from a lambda or functor.
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
| Construct from a const lambda or functor.
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !etl::is_same<etl::delegate<TReturn(TArgs...)>, TLambda>::value && !etl::is_convertible<TLambda, function_ptr>::value, void>>
ETL_CONSTEXPR14 | delegate (TLambda &&instance)=delete
ETL_CONSTEXPR14 | delegate (function_ptr fp) ETL_NOEXCEPT
| Construct from a function pointer.
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.
ETL_CONSTEXPR14 void | set (function_ptr fp) ETL_NOEXCEPT
| Set from a function pointer.
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
delegate & | operator= (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 delegate & | operator= (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 delegate & | operator= (const TLambda &instance) ETL_NOEXCEPT
| Create from const Lambda or Functor.
ETL_CONSTEXPR14 delegate & | operator= (function_ptr fp) ETL_NOEXCEPT
| Assign from a function pointer.
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.
static ETL_NODISCARD ETL_CONSTEXPR14 delegate | create (function_ptr fp) ETL_NOEXCEPT
| Create from a function pointer.
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.

## Constructor & Destructor Documentation

## delegate()

template<typename TReturn, typename... TArgs>
template<typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value && !etl::is_same<etl::delegate<TReturn(TArgs...)>, TLambda>::value && !etl::is_convertible<TLambda, function_ptr>::value, void>>

ETL_CONSTEXPR14 etl::delegate< TReturn(TArgs...)>::delegate | ( | TLambda && | instance | ) |

delete

Delete construction from an rvalue reference lambda or functor. Excludes non-capturing lambdas convertible to a function pointer.

## 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 | ( |  | ) |

inline static

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 | ( |  | ) |

inline static

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 | ( |  | ) |

inline static

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 | ) |

static delete

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:

- include/etl/private/delegate_cpp11.h