Locoduino/RingBuffer

Push into buffer overwriting first element

KovacsGG opened this issue · 2 comments

I want to have the last N number of measurements in my buffer, so it'd be useful to just overwrite old data.

Right now I have to check if my push failed, and do a pop into a dummy variable. I can't manually increment/wrap the read index and decrement size, because those are private.

Is there a better way of doing this? Do you think a forcePush/force method is worthwhile that'd perform the dummy "pop" when full instead of returning false is worthwhile?

Hello,

I will look at it today

Best regards

Release 1.0.4 corresponding to commit 683e522 should fulfill the requirement.

Best regards