正常
flat_map: ordered-container design lessons from Chromium
This directory takes apart Chromium's flat_map / flat_tree and works through the industrial-grade design of implementing an associative container on a sorted vector: why an array beats a tree at small data sizes, the read-heavy write-light workloads that are its home turf, the zero-cost sorted_unique construction, transparent comparators, and EBO. It is the sister series to OnceCallback and WeakPtr, rounding out the container-and-performance dimension of vol9/chrome.
Complete tutorial (full/)
Prerequisites (6 articles):
- flat_map prerequisite (0): ordered associative containers and std::map's red-black tree
- flat_map prerequisite (I): std::vector internals and growth
- flat_map prerequisite (II): complexity and amortized analysis
- flat_map prerequisite (III): comparators, strict_weak_order, and transparent lookup
- flat_map prerequisite (IV): tag dispatch and sorted_unique_t
- flat_map prerequisite (V): NO_UNIQUE_ADDRESS, EBO, and pair storage
Hands-on practice (6 articles):
- flat_map hands-on (I): motivation and API design
- flat_map hands-on (II): the flat_tree core skeleton
- flat_map hands-on (III): lookup and insert
- flat_map hands-on (IV): sorted_unique construction optimization
- flat_map hands-on (V): iterator invalidation and bulk construction
- flat_map hands-on (VI): testing and performance comparison
Advanced design guide (hands_on/)
Aimed at readers with template and performance experience: