11template <
class T, std::
size_t N>
12std::array<T, N>
operator+(
const std::array<T, N> &l,
const std::array<T, N> &r) {
13 std::array<T, N> result;
14 for (std::size_t i = 0; i < N; i++)
15 result[i] = l[i] + r[i];
19template <
class T, std::
size_t N>
20std::array<T, N>
operator-(
const std::array<T, N> &l,
const std::array<T, N> &r) {
21 std::array<T, N> result;
22 for (std::size_t i = 0; i < N; i++)
23 result[i] = l[i] - r[i];
27template <
class T, std::
size_t N> std::array<T, N>
operator*(
const std::array<T, N> &l,
const float &r) {
28 std::array<T, N> result;
29 for (std::size_t i = 0; i < N; i++)
34template <
class T, std::
size_t N> std::array<T, N>
operator*(
const float &l,
const std::array<T, N> &r) {
40template <
typename Type,
typename OtherType, std::size_t Size,
typename... Types,
41 class =
typename std::enable_if<
sizeof...(Types) != Size>::type>
42constexpr std::array<Type, Size>
convert(
const std::array<OtherType, Size> source,
const Types... data);
44template <
typename Type,
typename OtherType, std::size_t Size,
typename... Types,
45 class =
typename std::enable_if<
sizeof...(Types) == Size>::type,
class =
void>
46constexpr std::array<Type, Size>
convert(
const std::array<OtherType, Size> source,
const Types... data);
48template <
typename Type,
typename OtherType, std::size_t Size,
typename... Types,
class>
49constexpr std::array<Type, Size>
convert(
const std::array<OtherType, Size> source,
const Types... data) {
50 return convert<Type>(source, data...,
static_cast<const Type
>(source[
sizeof...(data)]));
53template <
typename Type,
typename OtherType, std::size_t Size,
typename... Types,
class,
class>
54constexpr std::array<Type, Size>
convert(
const std::array<OtherType, Size> source,
const Types... data) {
55 return std::array<Type, Size>{{data...}};
64 void add(
const T &data) {
74 T
get_average()
const {
return 1.0f /
static_cast<float>(n) * sum; }
constexpr std::array< Type, Size > convert(const std::array< OtherType, Size > source, const Types... data)
std::array< T, N > operator-(const std::array< T, N > &l, const std::array< T, N > &r)
std::array< T, N > operator*(const std::array< T, N > &l, const float &r)
std::array< T, N > operator+(const std::array< T, N > &l, const std::array< T, N > &r)