Factory that creates a YCombinator from a callable.
Synopsis
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 &&>);
Description
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); });
Return Value
A YCombinator storing a decayed copy of the callable.
Parameters
Name |
Description |
f |
The callable to wrap. |
Created with MrDocs