Skip to content

Instantly share code, notes, and snippets.

@picanumber
Last active November 23, 2016 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save picanumber/77bbf4dea85b7e8beddf6bd67669b356 to your computer and use it in GitHub Desktop.
Save picanumber/77bbf4dea85b7e8beddf6bd67669b356 to your computer and use it in GitHub Desktop.
struct Comp
{
template <class F1, class F2>
auto operator()(F1 lhs, F2 rhs)
{
return [=](auto... args)
{
return lhs(rhs(args...));
// ^^^^^^^^^^^^^^^^^
};
}
};
template <class... Ts>
auto compose(Ts&&... args)
{
using fld::Op;
return (Op<Comp>(std::forward<Ts>(args)) + ...).give();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment