Factory that creates a YCombinator from a callable.
Declared in <mrdocs/ADT/Overload.hpp>
template<class F>
[[nodiscard]]
constexpr
YCombinator<std::decay_t<F>>
yCombinator(F&& f) noexcept(std::is_nothrow_constructible_v<std::decay_t<F>, F &&>);
Prefer this helper to avoid spelling template arguments explicitly.
auto fib = fn::yCombinator( []self, int n) -> int { return n <= 1 ? n : self(n - 1) + self(n - 2); });
A YCombinator storing a decayed copy of the callable.
The return value should not be discarded.
| Name | Description |
|---|---|
| f | The callable to wrap. |