Hello,
could anyone explain me how do this below? I need to return the number of elements summed in way to do the mean. Is there anybody, please?
Qt Code:
  1. class Value {
  2. public:
  3. double _value;
  4. bool _missed;
  5. bool getMissed() const { return _missed; }
  6. //other methods....
  7. };
  8. class Other {
  9. vector<Value> _values;
  10. static double sum_values(const double& accum, const Value& right) {
  11. if ( right.getMissed() ) return accum;
  12. return accum + right._value;
  13. }
  14. void computeMean() {
  15. double mean = std::accumulate( _values.begin(), _values.end(), 0.0,
  16. Other::sum_values );
  17. }
  18. };
To copy to clipboard, switch view to plain text mode