3 ms·
why isn't it "auto this"? That that would make it <type> <name> like everything else in the language
by dataangel 4y ago
why isn't it "auto this"? That that would make it <type> <name> like everything else in the language
- kaashif 4y agoThe name is "self" not "this". "this" is a keyword indicating it's the explicit object parameter, it's not even actually a type. C++ seems to be trying to maximise confusion these days.
- jcelerier 4y agostruct foo { void bar(int a, int b) { auto lambda = [&] (auto this self) { this->compute(); }; } void compute(); }; if the variable name was "auto this" you wouldn't be able to refer to "compute" through the "this" of the parent class here