jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
func::ylambda_target_t is a Y combinator and deducing this implementation for lambda closures usable for recursive algorithms. More...
#include <functional.hpp>
Public Types | |
typedef delegate_t< R, A... > | delegate_type |
Static Public Member Functions | |
static delegate_type | delegate (L function) noexcept |
func::ylambda_target_t is a Y combinator and deducing this implementation for lambda closures usable for recursive algorithms.
The Y combinator allows passing the unnamed lambda instance itself, enabling recursive invocation from within the lambda.
In other words, a this
reference of the unnamed lambda is passed to the lambda, similar to Deducing this
.
The ylambda function<R(A...)> is invoked w/o explicitly passing the object parameter, as it is implicitly passed down to the user's lambda implementation.
Example implementing a recursive lambda factorial function
An instance is identifiable as func::target_type::ylambda via jau::function<R(A...)>::type().
R | function return type |
L | typename holding the lambda closure |
A | function arguments |
Definition at line 1005 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::ylambda_target_t< R, L, A >::delegate_type |
Definition at line 1007 of file functional.hpp.
|
inlinestaticnoexcept |