Embracing `noexcept` Operators and Specifiers Safely
summary
Shows concrete behavior: the noexcept operator inspects entire expression (including temporaries and destructors), how that forces copies in a vector push_back with reserve and move/swap example, and where compilers disagree; documents a small benchmark and exact static_assert constraints used to force or reject algorithms. Points out surprising defaults (destructors often not noexcept), strong-exception-guarantee copy blowup, and proposes a practical C++23 fix — essentially an optimization-only noexcept2 to separate contract from optimization.
AI-written summary · about
chapters (20)
- 0:00Start
- 0:54John Lakos
- 9:18Description
- 9:33The Primary Purpose Improve Algorithmic Performance in Generic Code
- 14:46Compound Expressions
- 16:42Explicitly Default Member Functions
- 17:16Applying no Accept Operator To Move Expressions
- 18:04Copy and Move Operations
- 19:03Review of R Value References
- 21:59Use Cases for the no Accept Operator
- 23:34The Strong Guarantee
- 24:34Write a Test Driver
- 37:27Directives
- 45:33Destructors
- 49:47Generic Context
- 51:44Violating an Exception
- 54:13Inheritance
- 55:04Use Case
- 59:59Pitfalls
- 1:01:23Conclusion
related talks
01h 02mModern C++ Safety and Security At 20
01h 02mPractical Tips for Safer C++
01h 04mUndefined Behavior in the STL
01h 13mPractical Tips for Safer C++
33mUndefined Behavior in C++: What Every Programmer Should Know and Fear
59m“The Exception Situation"
01h 00mint != safe && int != ℤ
01h 04mRemoving Needless Undefined Behavior for a Safer C++
