Great C++ is_trivial
summary
Defines exactly which type traits let the compiler elide work and shows concrete assembly and compiler behaviors: ints and trivial aggregates compile to identical code while std::string forces nontrivial moves/copies, structured bindings defeat some RVO cases, and compilers still emit std::move calls in unoptimized builds. Builds a fixed-capacity constexpr container to prove many types can be made trivially copyable and demonstrates when return value optimization and implicit moves do or do not apply, and which classes (polymorphic or resource-managing) cannot be trivial.
AI-written summary · about
chapters (17)
- 0:00Introduction and speaker intro
- 1:35Defining great C++ code
- 3:02Return value optimization exercise
- 9:57Out parameters vs return values
- 16:50Understanding trivial destructibility
- 19:41Trivially copyable types explained
- 22:39Trivial constructibility deep dive
- 27:53What makes a trivial type
- 30:07Efficiency of trivial types
- 33:38Structured bindings and triviality
- 35:05Pass by value vs pass by move
- 37:02Out parameters and undefined behavior
- 41:03Assignment vs initialization optimized
- 42:50When triviality depends on type
- 44:45What cannot be trivial
- 46:06Making containers trivial
- 51:23Rule of zero and triviality
related talks
57mSome Things C++ Does Right
12mTraits Go Mainstream...
01h 13mType safe C++ – LOL! :-)
01h 02mOn the benefits of non-intrusiveness
01h 03mC++ Trivial Relocation Through Time
56mCute C++ Tricks (and what you can learn from them): Part 2 of N
59mA Tour of C++ Recognised User Type Categories
01h 22mThese 10 tricks that only library implementors know!
