Created
May 25, 2014 06:55
-
-
Save lshort/e8fe650fb548054ee05d 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
template<typename return_type, typename arg1_type, typename ...params> | |
auto _L1( return_type (*fp) (arg1_type x, params...args), arg1_type x) | |
{ return [fp, x] (params...args) { return fp(x,args...); }; }; | |
double mult(double x, double y) { return x*y; } | |
auto to_radians = _L1(mult,M_PI/180.0); | |
auto cos_in_degrees = _L(cos) * to_radians; | |
cout << cos_in_degrees(45.0) << endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment