diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-29 00:02:45 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-29 00:02:45 +0000 |
commit | 79fb157cf81d790d49fda1c9ee2c67d90a1f0164 (patch) | |
tree | 2446a0babb20e47a5dba96238b0771cb5190e1c4 | |
parent | Add helper to apply perspective division (diff) | |
download | ilt-79fb157cf81d790d49fda1c9ee2c67d90a1f0164.tar.bz2 ilt-79fb157cf81d790d49fda1c9ee2c67d90a1f0164.tar.xz ilt-79fb157cf81d790d49fda1c9ee2c67d90a1f0164.zip |
constexpr collections helpers
-rw-r--r-- | lib/collections.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp index 5f4be68..c9b0127 100644 --- a/lib/collections.hpp +++ b/lib/collections.hpp @@ -3,7 +3,7 @@ #include <array> template<typename T, std::size_t first, std::size_t second> -std::array<T, first + second> +constexpr std::array<T, first + second> operator+(const std::array<T, first> & a, const std::array<T, second> & b) { std::array<T, first + second> r; @@ -14,7 +14,7 @@ operator+(const std::array<T, first> & a, const std::array<T, second> & b) } template<typename T, std::size_t N> -auto +constexpr auto operator*(const std::array<T, N> & in, auto && f) { std::array<decltype(f(in[0])), N> out; @@ -26,7 +26,7 @@ operator*(const std::array<T, N> & in, auto && f) } template<typename T, std::size_t N> -auto & +constexpr auto & operator*=(std::array<T, N> & in, auto && f) { for (const auto & v : in) { |