From 4912476a6a13c0cf2291d35c5b8850d76c291abc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 30 Dec 2022 15:04:40 +0000 Subject: Allow operator*= on spans, not just arrays --- lib/collections.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/collections.hpp b/lib/collections.hpp index beb01f8..b87cda3 100644 --- a/lib/collections.hpp +++ b/lib/collections.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include template constexpr std::array @@ -39,11 +40,12 @@ operator*(const std::array & in, auto && f) return out; } -template +template constexpr auto & -operator*=(std::array & in, auto && f) +operator*=(std::span & in, auto && f) { - for (const auto & v : in) { + for (auto & v : in) { f(v); } + return in; } -- cgit v1.2.3