Circular Buffer

Martijn Pot martijnpot52 at gmail.com
Tue Feb 11 00:15:35 PST 2014


> auto data = [1,2,3];
> assert( data.cycle.rotate(2) == [3,1,2] );
> assert( data.cycle.rotate(-2) == [2,3,1] );

It's not of immediate help, but it might trigger other answers. 
Matlab offers this for multi-dimensional arrays:

http://www.mathworks.nl/help/matlab/ref/circshift.html


More information about the Digitalmars-d-learn mailing list