A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove

closure


 

etl::closure wraps an etl::delegate and a set of arguments.

____________________________________________________________________________________________________

C++11 and above.

etl::closure<TReturn(TArgs...)>

____________________________________________________________________________________________________

C++03.

etl::delegate<TReturn(TArg0)>

etl::delegate<TReturn(TArg0, TArg1)>

etl::delegate<TReturn(TArg0, TArg1, TArg2)>

etl::delegate<TReturn(TArg0, TArg1, TArg2, TArg3)>

etl::delegate<TReturn(TArg0, TArg1, TArg2, TArg3, TArg4)>

____________________________________________________________________________________________________

Types


 

delegate_type   The delegate type etl::delegate<TReturn(TArgs...)>

____________________________________________________________________________________________________

Constructor


 

C++11 and above.

ETL_CONSTEXPR14 closure(const delegate_type& f, const TArgs... args)

____________________________________________________________________________________________________

C++03.

closure(const delegate_type& f, const TArg0 arg0)

closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1)

closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1, const TArg2 arg2)

closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1, const TArg2 arg2,

                                const TArg3 arg3)

closure(const delegate_type& f, const TArg0 arg0, const TArg1 arg1, const TArg2 arg2,

                                const TArg3 arg3, const TArg4 arg4)

____________________________________________________________________________________________________

Operations


template <size_t index, typename UArg>

void bind(UArg arg)

Bind a new value to the argument at the specified index.
UArg must be one of TArgs.

Only non-reference types can be rebound.

C++11 and above.

____________________________________________________________________________________________________

template <typename... UArgs>

void bind(UArgs&&... args)

Bind new values to all of the arguments at once.

The number of arguments must match the delegate.

C++11 and above.

____________________________________________________________________________________________________

ETL_CONSTEXPR14 TReturn operator()(TParams... args) const

Executes the delegate.

 

closure.h