|
|
|
|
|
by jawilson2
2904 days ago
|
|
I use deques A LOT, e.g. interthread messaging, and decaying/windowed time series calculations. Like, if you want a running mean of the last 250ms, you put a timestamp and value pair in the back a deque, and every update you check the front of the deque to see if it should be popped (i.e. the timestamp is older than 250ms), and the mean updated. I suppose you could use a circular buffer with a vector as well, but you have to guess what your max size will ever be, or handle dynamic resizing. Maybe it would be worth it in some circumstances. |
|