Skip to content

Hand-Rolling mini STL: A Container Library in Practice ​

We hand-roll a teaching-oriented mini container library of our own (namespace tamcpp::ministl): starting from a raw buffer that "manages capacity, not objects", we work our way up to an LRU cache. Each time we finish a piece, we hold it up against a real industrial implementation as a mirror — the dynamic array against std::vector and Chromium's vector_buffer, the classic linked list against libstdc++'s stl_list, hashing against absl's swiss table, and the ring buffer, intrusive containers, and LRU cache against Chromium's base/containers. Whichever mirror we borrow, its error handling comes along: the std mirror throws exceptions, the Chromium mirror crashes on the spot.

Prerequisites: you have read the conceptual layer of the vol3 containers volume, you can read template specializations and variadic templates, and ideally you have dealt with placement new at least once. The companion code lives in code/volumn_codes/vol8-labs/ministl/ and advances stage by stage in separate directories (currently stage1_rawbuf_vector/: RawBuffer and Vector); every article's output can be reproduced verbatim in there.

Prerequisites ​

Hands-On Series ​

We keep pushing this series forward module by module. Upcoming articles will revolve around the ring buffer, linked lists (singly linked, doubly linked, intrusive), ordered and hash maps, heaps, and the LRU cache; each one gets its link added here as soon as it lands.

pdf-latest-4-g85128cc · 85128cc · 2026-10-05