Skip to content

Instantly share code, notes, and snippets.

@w495
Created December 11, 2013 14:07
Show Gist options
  • Save w495/7910990 to your computer and use it in GitHub Desktop.
Save w495/7910990 to your computer and use it in GitHub Desktop.
add(1)(2)(3) // 6
#include <iostream>
struct TAdd {
int r;
TAdd operator() (int x) { return {r + x}; }
operator int() { return r; }
};
TAdd add(int x) { return {x}; }
int main() { std::cout << add(1)(2)(3) << std::endl; return 0; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment