Circular buffer (source code)

= Circular buffer

= Ring buffer
{synonym}

A <circular buffer> uses a fixed-capacity <array> with indices that wrap through <modular arithmetic>. A front index and an occupied count can represent a <FIFO queue> without shifting entries after removal. The <representation independence> example specifies a rejecting full-buffer policy; overwriting the oldest entry would define different behavior.