正常
NoDestructor: static lifetime management, learned from Chromium
This directory takes apart Chromium's base::NoDestructor<T> and works through the lifetime management of global and static objects: why Chromium bans global constructors and destructors, how placement new manages lifetime by hand, the thread safety of magic statics, and the "intentional leak" tradeoff. It sits alongside OnceCallback, WeakPtr, and flat_map, rounding out the static-lifetime piece of vol9/chrome.
NoDestructor is a lightweight component (a thin header-only wrapper), so this series is shorter than the other three.
Full tutorial (full/)
- Prerequisites: static storage duration, init, and destruction, placement new and aligned storage
- Hands-on: motivation and API, core implementation, when to use, LSan and leaks
Hands-on design guide (hands_on/)
For readers comfortable with templates and lifetime: motivation, interface, and implementation, usage boundaries and testing.