3 ms·
Amazing :) I did not know that you could access lambda capture expressions. This can indeed reproduce parts of iod's features. However, this syntax does not pro
by matt42 12y ago
Amazing :) I did not know that you could access lambda capture expressions. This can indeed reproduce parts of iod's features. However, this syntax does not provides static introspection, and does not support nesting properly :
auto obj = [ name = 1, a = [name = 1]{} ]{};
obj.a.name;
test.cc: In function ‘int main()’:
test.cc:5:38: warning: already captured ‘name’ in lambda expression
auto obj = [ name = 1, a = [name = 1]{} ]{};
^
test.cc:7:9: error: ‘struct main()::<lambda()>’ has no member named ‘name’
obj.a.name;
- yyyymmdd 12y agothat's not syntax not supporting nesting, that's gcc having bugs with nested captures. clang++ does not error on this. (strange, but this does not compile with gcc and clang versions I have currently at hand. It did compile a few weeks ago when I tried it...)