rendered paste body#include <functional>#include <cstdio>template <typename R, typename V1, typename V2>std::function<R(V2)> pa(const std::function<R(V1,V2)> &f, V1 v) { return [&](V2 x) { return f(v, x); };}template <typename R, typename V1, typename V2>std::function<std::function<R(V1)>(V2)> curry(const std::function<R(V1,V2)> &f) { return [&](V2 x) { return pa(f, x); };}template <typename Lhs, typename Rhs>auto times(const Lhs &lhs, const Rhs &rhs) -> decltype(lhs * rhs) { return lhs * rhs;}int main() { std::function<int(int, int)> itimes = times<int, int>; printf("pa: %d\n", pa(itimes, 10)(20)); printf("curry: %d\n", curry(itimes)(10)(20));}