barrettruth.com/public/code/trading/extrema-circular-buffer/ringbuffer.cpp