Skip to content

Instantly share code, notes, and snippets.

@kaushiks
Created May 15, 2013 02:46
Show Gist options
  • Save kaushiks/5581323 to your computer and use it in GitHub Desktop.
Save kaushiks/5581323 to your computer and use it in GitHub Desktop.
Currying in C++
#include <stdio.h>
class Adder {
public:
Adder(int n): n(n) {}
int operator()(int other) { return other + n; }
private:
int n;
};
int main(int argc, char *argv[])
{
Adder a(4);
printf("%d\n", a(38));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment