Skip to content

Instantly share code, notes, and snippets.

@Garciat
Last active August 29, 2015 14:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
// lambda syntax; construction & call
int x = 0;
int y = 10;
[x, &y] (int z) { return x + (++y) + (++z); } (5);
// desugared
struct __lambda1 {
int x;
int &y;
constexpr __lambda1(int _x, int &_y) : x(_x), y(_y) { }
decltype(auto) operator() (int z) const {
return x + (++y) + (++z);
}
};
// construction & call
int x = 0;
int y = 10;
__lambda1(x, y)(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment