
6 Nov
2010
6 Nov
'10
3:26 a.m.
maximum number, or some condition on the stored data (e.g. the sum must be below a threshold) is met. So I figured I'd store the data in a circular buffer, and push new data onto the front, and store my own iterator into it to use as the end.
Anthony, Would it be viable to simply erase the remaining items, rather than storing the iterator my_end?
From an efficiency point of view it seems like the sum could be updated for each push, and then iteration over the items that need removing (from the end), rather than re-traversing the items at the front that need to be kept.
Just a thought. - Nigel