mrdocs::YCombinator
Enables recursive lambdas by passing a self‐reference as the first argument.
Member Functions
Name |
Description |
|
Constructs a YCombinator from the given callable. |
Function call operators |
Description
YCombinator stores a callable F and exposes operator() that forwards arguments to F, prepending a reference to *this so that F can recurse.
Overloads are provided for &, const&, &&, const&& to preserve value category.
auto fact = fn::yCombinator( []self, int n) ‐> long long { return n <= 1 ? 1 : n * self(n ‐ 1); }); auto r = fact(10);
Template Parameters
Name |
Description |
F |
The callable to wrap. |
Created with MrDocs