Created
July 23, 2018 03:25
-
-
Save fortheday/10afff5b5c8c22abace7861c627991a3 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
void TestLambda() | |
{ | |
int i = 0; | |
double d = 0.0; | |
auto f0 = []() { puts("aa"); }; // sizeof(empty struct) == 1 | |
auto f1 = [myI = i]() { }; // sizeof(struct { int }) == 4 | |
auto f2 = [myD = d]() { }; // sizeof(struct { double }) == 8 | |
printf("sizeof f0[%zu] f1[%zu] f2[%zu]", sizeof(f0), sizeof(f1), sizeof(f2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment