coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Computes average of a sequence of values. More...
Functions | |
template<typename F > | |
auto | coveo::linq::average (const F &num_f) -> detail::average_impl< F > |
Computes average using numerical function. More... | |
The average
operator computes the average of all values in a sequence. To achieve this, it needs a numerical function to extract a numeric value from each sequence element.
This is a terminal operator.
.NET equivalent: Average
auto coveo::linq::average | ( | const F & | num_f | ) | -> detail::average_impl<F> |
Computes the average of all elements in a sequence by repeatedly calling a numerical function. The function receives an element as parameter and must return a numerical value for the element. The final result is the average of all such numerical values.
Does not work on empty sequences.
Use like this:
num_f | Function to get numerical value for each element. |
coveo::linq::empty_sequence | The sequence contains no elements. |