What is a Y_combinator

Revision en1, by akasakaR, 2024-08-12 17:58:50

What is a Y combinator where I see some ppl using it, it looks something like this:

template<class F>
struct y_combinate_t {
  F f;
  template<class...Args>
  decltype(auto) operator()(Args&&...args)const {
    return f(*this, std::forward<Args>(args)...);
  }
};
template<class F>
y_combinate_t<std::decay_t<F>> y_combinate( F&& f ) {
  return {std::forward<F>(f)};
};

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English akasakaR 2024-08-12 17:58:50 425 Initial revision (published)