title: Calculating moving average in C++
body: <p>I am trying to calculate the moving average of a signal. The signal value ( a double ) is updated at random times. 
  I am looking for an efficient way to calculate it's time weighted average over a time window, in real time. I could do it my self, but it is more challenging than I thought.</p>
  
  <p>Most of the resources I've found over the internet are calculating moving average of periodical signal, but mine updates at random time.</p>
  
  <p>Does anyone know good resources for that ?</p>
  
  <p>Thanks</p>