Statistics  1.0.0
A C++17 for profiling and constant time statistical calculation
statistics.h File Reference

A class to measure various statistics of a population. All operations (except iterator insert), are O(1), and the Statistics class uses a minimal, fixed amount of memory (i.e. it does NOT keep a list of all members of its population);. More...

#include <algorithm>
#include <initializer_list>
#include <limits>
#include <utility>

Go to the source code of this file.

Classes

class  Statistics< T >
 Keeps a simple average of a series of measurements. More...
 

Functions

template<class T >
Statistics< T > operator+ (const Statistics< T > &lhs, const T &rhs) noexcept
 Adds a measurement to the population. More...
 
template<class T >
Statistics< T > & operator+ (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Combine two populations. More...
 
template<class T >
bool operator== (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Equality operator. More...
 
template<class T >
bool operator!= (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Inequality operator. More...
 
template<class T >
bool operator< (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Less than operator. More...
 
template<class T >
bool operator<= (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Less than or equal to operator. More...
 
template<class T >
bool operator> (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Greater than operator. More...
 
template<class T >
bool operator>= (const Statistics< T > &lhs, const Statistics< T > &rhs) noexcept
 Greater than or equal to operator. More...
 

Detailed Description

A class to measure various statistics of a population. All operations (except iterator insert), are O(1), and the Statistics class uses a minimal, fixed amount of memory (i.e. it does NOT keep a list of all members of its population);.

Function Documentation

◆ operator!=()

template<class T >
bool operator!= ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Inequality operator.

O(1) complexity.

Parameters
[in]lhsleft hand population
[in]rhsright hand population

◆ operator+() [1/2]

template<class T >
Statistics<T>& operator+ ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Combine two populations.

O(1) complexity.

Parameters
[in]lhsfirst population
[in]rhssecond population
Returns
The resulting population

◆ operator+() [2/2]

template<class T >
Statistics<T> operator+ ( const Statistics< T > &  lhs,
const T &  rhs 
)
inlinenoexcept

Adds a measurement to the population.

O(1) complexity.

Parameters
[in]populationpopulation to add the measurement to
[in]measurementmeasurement to add
Returns
The resulting population

◆ operator<()

template<class T >
bool operator< ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Less than operator.

O(1) complexity.

Parameters
[in]lhsleft hand population
[in]rhsright hand population

◆ operator<=()

template<class T >
bool operator<= ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Less than or equal to operator.

O(1) complexity.

Parameters
[in]lhsleft hand population
[in]rhsright hand population

◆ operator==()

template<class T >
bool operator== ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Equality operator.

O(1) complexity.

Parameters
[in]lhsleft hand population
[in]rhsright hand population

◆ operator>()

template<class T >
bool operator> ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Greater than operator.

O(1) complexity.

Parameters
[in]lhsleft hand population
[in]rhsright hand population

◆ operator>=()

template<class T >
bool operator>= ( const Statistics< T > &  lhs,
const Statistics< T > &  rhs 
)
inlinenoexcept

Greater than or equal to operator.

O(1) complexity.

Parameters
[in]lhsleft hand population
[in]rhsright hand population