C++ Const Correctness Refresher
summary
Covers concrete const-correctness fixes: use strict compiler diagnostics and static analysis, make objects const by default, and propagate immutability for owned data by returning const references or smart pointers instead of exposing mutable backdoors. Shows common failures from open-source reviews—auto type deduction dropping const, pointer reassignment vs comparison, iterator proxies and smart-pointer reassignment—and gives fixes like explicit reference/pointer syntax, immediate lambda initialization for const locals, and using mutable for internal caches while warning about thread-safety.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:11Const-correctness
- 1:14Why is it important ?
- 2:10Guidelines and standards
- 3:05Variables
- 6:13Auto type deduction
- 9:01Smart pointers
- 9:26Function parameters
- 10:36Initialization
- 11:32Objects
- 14:49Immutable visible state
- 16:40Recommendations/considerations (reflect my opinion)
related talks
53m“The Importance of Being const"
01h 02mBack to Basics: Const as a Promise
05mThis is Why We Can't Have Nice Things
51mTypical C++, but Why?
54mTypical C++, But Why?
01h 41mWriting Good C++14
32mCute C++ Tricks, Part 2 of N: More code you should learn from and never write
58mHow to Build Cpp Interfaces That Are Hard to Use Incorrectly
