diff --git a/include/omath/mat.hpp b/include/omath/mat.hpp index 6b53821..d8cf403 100644 --- a/include/omath/mat.hpp +++ b/include/omath/mat.hpp @@ -9,6 +9,7 @@ #include #include #include "omath/vector3.hpp" +#include #ifdef near @@ -141,12 +142,7 @@ namespace omath [[nodiscard]] constexpr Type Sum() const noexcept { - Type sum = 0; - for (size_t i = 0; i < Rows; ++i) - for (size_t j = 0; j < Columns; ++j) - sum += At(i, j); - - return sum; + return std::accumulate(m_data.begin(), m_data.end(), Type(0)); } constexpr void Clear() noexcept