I know this is achievable with boost as per:
Using boost::accumulators, how can I reset a rolling window size, does it keep extra history?
But I really would
a simple moving average for 10 items, using a list:
#include
std::list listDeltaMA;
float getDeltaMovingAverage(float delta)
{
listDeltaMA.push_back(delta);
if (listDeltaMA.size() > 10) listDeltaMA.pop_front();
float sum = 0;
for (std::list::iterator p = listDeltaMA.begin(); p != listDeltaMA.end(); ++p)
sum += (float)*p;
return sum / listDeltaMA.size();
}