#pragma once #include template constexpr std::array operator+(const std::array & a, const std::array & b) { std::array r; auto out = r.begin(); out = std::copy(a.begin(), a.end(), out); std::copy(b.begin(), b.end(), out); return r; } template constexpr std::array, first * second> operator*(const std::array & a, const std::array & b) { std::array, first * second> r; auto out = r.begin(); for (const auto & ae : a) { for (const auto & be : b) { *out++ = {ae, be}; } } return r; } template constexpr auto operator*(const std::array & in, auto && f) { std::array out; for (auto outitr = out.begin(); const auto & v : in) { *outitr++ = f(v); } return out; } template constexpr auto & operator*=(std::array & in, auto && f) { for (const auto & v : in) { f(v); } }