正常
NoDestructor: static lifetime management lessons 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 is the sister series to OnceCallback, WeakPtr, and flat_map, rounding out the static-lifetime piece of vol9/chrome.
NoDestructor is a lightweight component (a thin header-only wrapper class), so this series is leaner than the previous three.
Complete tutorial (full/)
- Prerequisites: static storage duration, initialization, and destruction, placement new and aligned storage
- Hands-on practice: motivation and API, core implementation, usage boundaries, LSan and leaks
Advanced design guide (hands_on/)
Aimed at readers with template and lifetime experience: motivation, API, and implementation, usage boundaries and testing.