const correctly in C++ :
summary
C++ const rules for pointers, members, and methods with concrete examples: pointer placement of const affects pointer vs pointee, const_cast causes undefined behavior when removing const from an originally-const object, prefer avoiding C-style casts, use const& parameters to avoid copies, and mark getters as const to enable correct polymorphism. Shows using mutable for a mutex inside a const object and demonstrates std::experimental::propagate_const (not supported on MSVC yet) to keep container-held pointers const-correct.
AI-written summary · about
chapters (16)
- 0:00Introduction and speaker background
- 1:16What is const in C++
- 3:06Const with pointers explained
- 5:16Const with objects and classes
- 7:34Const methods and API contracts
- 9:06Dangers of const_cast misuse
- 13:13Mutable keyword for controlled mutability
- 14:48Const correctness in APIs
- 16:39Const and method overloading
- 18:26Const pointers in POSIX functions
- 21:22Const in STL containers
- 22:54Const iterators in STL
- 23:57Const references for performance
- 24:41Why const matters in legacy code
- 26:54Propagating const correctness
- 28:22Summary and best practices
