5 # ifndef VCCC_NUMERIC_AVERAGE_HPP
6 # define VCCC_NUMERIC_AVERAGE_HPP
29 assert(((
void)
"input size muse be larger than 0",
first != last));
30 using return_type = decltype(*
first);
41 template<
typename InputIterator,
typename UnaryOperation,
44 average(InputIterator
first, InputIterator last, UnaryOperation unary_op)
46 assert(((
void)
"input size muse be larger than 0",
first != last));
47 using return_type = decltype(unary_op(*
first));
62 template<
typename ...Numbers,
63 std::enable_if_t<conjunction<std::is_arithmetic<Numbers>...>
::value,
int> = 0>
77 template<
typename ...Args,
80 negation<disjunction<is_iterable<Args>...>>,
81 negation<disjunction<std::is_arithmetic<Args>...>>
87 return sum(args...) /
static_cast<double>(
sizeof...(args));
98 template<
typename ...Ints,
99 std::enable_if_t<conjunction<std::is_integral<Ints>...>
::value,
int> = 0>
typename signed_bigger_type< Ts... >::type signed_bigger_type_t
Definition: bigger_type.hpp:99
constexpr auto average(InputIterator first, InputIterator last)
get average of iterator values [first, last)
Definition: average.hpp:28
constexpr auto sum(InputIterator first, InputIterator last)
sum of iterator [first, last)
Definition: sum.hpp:57
constexpr auto int_average(Ints... ints)
get average value of integers(result is floored)
Definition: average.hpp:102
constexpr VCCC_INLINE_OR_STATIC detail::distance_niebloid distance
Definition: distance.hpp:72
typename std::conditional_t< conjunction< std::is_same< Types, float >... >::value, float, double > decay_if_float_t
Definition: lossless_type.hpp:20
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 0 > first
Definition: key_value.hpp:34
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35