Qt 4.8
Functions
qbenchmark.cpp File Reference
#include "QtTest/qbenchmark.h"
#include "QtTest/private/qbenchmark_p.h"
#include "QtTest/private/qbenchmarkmetric_p.h"
#include <QtCore/qprocess.h>
#include <QtCore/qdir.h>
#include <QtCore/qset.h>
#include <QtCore/qdebug.h>

Go to the source code of this file.

Functions

template<typename T >
Q_TYPENAME T::value_type qAverage (const T &container)
 

Function Documentation

◆ qAverage()

template<typename T >
Q_TYPENAME T::value_type qAverage ( const T &  container)

Definition at line 297 of file qbenchmark.cpp.

298 {
299  Q_TYPENAME T::const_iterator it = container.constBegin();
300  Q_TYPENAME T::const_iterator end = container.constEnd();
301  Q_TYPENAME T::value_type acc = Q_TYPENAME T::value_type();
302  int count = 0;
303  while (it != end) {
304  acc += *it;
305  ++it;
306  ++count;
307  }
308  return acc / count;
309 }
#define it(className, varName)
#define Q_TYPENAME
Definition: qglobal.h:1717
static const KeyPair *const end