From 76b4e1a1ee3d8318e9a31664f5fbb9a509f7b1fe Mon Sep 17 00:00:00 2001 From: Christopher Durand Date: Tue, 6 Feb 2024 20:09:52 +0100 Subject: [PATCH] [math] Fix enumerate() when range reference type is not a reference --- src/modm/math/algorithm/enumerate.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modm/math/algorithm/enumerate.hpp b/src/modm/math/algorithm/enumerate.hpp index 883ef1884d..39c27c5d8b 100644 --- a/src/modm/math/algorithm/enumerate.hpp +++ b/src/modm/math/algorithm/enumerate.hpp @@ -12,8 +12,10 @@ #pragma once -#include +#include +#include #include +#include namespace modm { @@ -31,7 +33,10 @@ constexpr auto enumerate(T && iterable) TIter iter; constexpr bool operator != (const iterator & other) const { return iter != other.iter; } constexpr void operator ++ () { ++i; ++iter; } - constexpr auto operator * () const { return std::tie(i, *iter); } + constexpr auto operator * () const + { + return std::tuple>{i, *iter}; + } }; struct iterable_wrapper {