Last active
August 29, 2015 14:01
-
-
Save shoooe/2fa1b9566b4efbcbd477 to your computer and use it in GitHub Desktop.
Simple implementation for partial function application in C++ (only works without overloaded functions, of course).
This file contains hidden or 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
#include <utility> | |
template<class Func, class... Args> | |
auto apply(Func fn, Args&&... args) { | |
return [&](auto&&... sargs) { | |
return fn | |
( std::forward<decltype(args)>(args)... | |
, std::forward<decltype(sargs)>(sargs)... ); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment