Created
November 23, 2016 01:18
-
-
Save picanumber/2101b93d4b57779ea44adb2433de7a3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Curry | |
{ | |
template <class F1, class F2> | |
auto operator()(F1&& lhs, F2&& rhs) | |
{ | |
return [ | |
lhs = perfect_capture_t<F1>(std::forward<F1>(lhs)), | |
rhs = perfect_capture_t<F2>(std::forward<F2>(rhs)) | |
](auto&&... args) | |
{ | |
return lhs(rhs, std::forward<decltype(args)>(args)...); | |
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
}; | |
} | |
}; | |
template <class... Ts> | |
auto curry(Ts&&... args) | |
{ | |
using fld::Op; | |
return (... + Op<Curry>(std::forward<Ts>(args))).give(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment