VCCC  2024.05
VisualCamp Common C++ library
average.hpp File Reference
#include <cassert>
#include <iterator>
#include "vccc/type_traits.hpp"
#include "vccc/__numeric/sum.hpp"

Go to the source code of this file.

Namespaces

 vccc
 

Functions

template<typename InputIterator , std::enable_if_t< is_iterable< InputIterator >::value, int > = 0>
constexpr auto average (InputIterator first, InputIterator last)
 get average of iterator values [first, last) More...
 
template<typename InputIterator , typename UnaryOperation , std::enable_if_t< is_iterable< InputIterator >::value, int > = 0>
constexpr auto average (InputIterator first, InputIterator last, UnaryOperation unary_op)
 get average of iterator values [first, last) More...
 
template<typename ... Numbers, std::enable_if_t< conjunction< std::is_arithmetic< Numbers >... >::value, int > = 0>
constexpr auto average (Numbers... numbers)
 get average value of arithmetic types More...
 
template<typename ... Args, std::enable_if_t< conjunction< negation< disjunction< is_iterable< Args >... >>, negation< disjunction< std::is_arithmetic< Args >... >> >::value, int > = 0>
constexpr auto average (const Args &... args)
 get average value of custom types More...
 
template<typename ... Ints, std::enable_if_t< conjunction< std::is_integral< Ints >... >::value, int > = 0>
constexpr auto int_average (Ints... ints)
 get average value of integers(result is floored) More...