A book keyed by std::map allocates a node for every new price level and follows pointers to find one. A price ladder replaces it with a fixed array indexed by price: slot (price - base) / tick holds the quantity at that price. Adding, reducing and reading a level are one array access, and nothing allocates after start-up.
The cost moves to the top of the book. The best bid is the highest slot with quantity, so the book keeps its index, best_: raise it when a better bid arrives, and when the best level empties, walk down to the next slot that has quantity. Most activity happens near the top, so that walk is usually short. Prices that are off the ladder are refused here; a production book would recenter the ladder around the market.
The tests count heap allocations across thousands of updates, and check the edge cases a book meets every day: the best level emptying, quantity reduced below zero, and prices between ticks.
A level update is an index calculation and an array write.