3 ms·
This is quite something! I intend to share w/ my coworkers :) If I had one thing I could have added to it: panel for understanding value categories[0] -- I
by chrsig 5y ago
This is quite something! I intend to share w/ my coworkers :)
If I had one thing I could have added to it: panel for understanding value categories[0] -- I have an incredibly hard time wrapping my head around how they're described. I attribute the difficulty to the cpp standard being excruciatingly complex, the language itself not being designed holistically, and backwards compatibility with itself and C.
[0] https://en.cppreference.com/w/cpp/language/value_category https://en.cppreference.com/w/cpp/language/value_category
- MauranKilom 5y agoHonestly, you don't have to understand value categories to this degree. The distinctions are important for writing the standard, but I've never once explained (or was explained) a line of code where diving into the depths of value categories would add anything. In practice it boils down to "if it has a name, you need to std::move it to get move semantics, otherwise you don't". Caveats apply (e.g. returning a named value).
- Jeaye 5y agoRegarding value categories, maybe this is also useful: https://raw.githubusercontent.com/jeaye/value-category-cheatsheet/master/value-category-cheatsheet.pdf https://raw.githubusercontent.com/jeaye/value-category-cheat...