3 ms·
No mention of smart pointers? I'd wager I use unique_ptr way more than type-safe time!
by electricslpnsld 8y ago
No mention of smart pointers? I'd wager I use unique_ptr way more than type-safe time!
- Guvante 8y ago`unique_ptr` is more of an investment as if you call `get()` all the time you can still end up with dangling references.
- kllrnohj 8y agoThe context of the talk was for game devs who currently largely avoid the STL, avoiding any debate on whether or not that avoidance makes sense.
- GuB-42 8y agoBecause smart pointers are a different way to code. It is not a drop in feature that makes your code better without any design change. In all examples you can't really argue. All these things are common patterns that require ugly hacks to work in traditional C++. Modern C++ made them the way people would naturally write them, and they don't involve self imposed restrictions or performance overheads. The chrono stuff is a bonus, not included in the main 7, probably chosen because of the author personal experience. But I understand that if you work with code that involve a lot of timing, it can be a godsend. Time unit mismatch can be incredibly frustrating, I've experienced it myself both as the culprit and as a victim.