al6x / RingBuffer.nim

Circular buffer implementation in Nim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nim implementation of Circular buffers Build Status

Documentation

A circular buffer, cyclic buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams.

Wikipedia

Usage

var b = newRingBuffer[int](5)

b.add([1, 2, 3, 4, 5])
b.add(6)
b.add([7, 8])

@b == [4, 5, 6, 7, 8]

About

Circular buffer implementation in Nim


Languages

Language:Nim 100.0%