Skip to content

Instantly share code, notes, and snippets.

@vinhnx
Created December 22, 2013 16:16
Show Gist options
  • Save vinhnx/8084784 to your computer and use it in GitHub Desktop.
Save vinhnx/8084784 to your computer and use it in GitHub Desktop.
// Creating a lambda in C++ with variable type inferred automatically
auto someLambda = [](float w, int x, int y) { return(x); };
// Creating a block in C/ObjC without the use of a typedef -- UGLY
int (^someBlock)(float, int, int) = ^(float w, int x, int y) { return(x); };
// Creating a block in CPP/ObjCPP with variable type inferred automatically -- NOT TOO BAD
auto someBlock = ^(float w, int x, int y) { return(x); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment