summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-08-12 22:38:53 +1000
committerMaxime Coste <mawww@kakoune.org>2024-08-14 22:04:52 +1000
commit449adb14a56f24fcfd9c836bcf69e1c4661fae89 (patch)
tree628d9ced4a21ac1cf8baefae02ddec479d2d6ca7 /src
parent01cb818c2077f5059bfa84834298bb813aa9baca (diff)
Remove tuple use from ranges.hh
Diffstat (limited to 'src')
-rw-r--r--src/ranges.hh9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ranges.hh b/src/ranges.hh
index 7b568cd2..1b6f8869 100644
--- a/src/ranges.hh
+++ b/src/ranges.hh
@@ -5,7 +5,6 @@
#include <utility>
#include <iterator>
#include <numeric>
-#include <tuple>
#include "constexpr_utils.hh"
@@ -191,7 +190,13 @@ struct EnumerateView
Iterator(size_t index, RangeIt it)
: m_index{index}, m_it{std::move(it)} {}
- decltype(auto) operator*() { return std::tuple<size_t, decltype(*m_it)>(m_index, *m_it); }
+ struct ValueType
+ {
+ size_t index;
+ decltype(*std::declval<RangeIt>()) element;
+ };
+
+ ValueType operator*() { return {m_index, *m_it}; }
Iterator& operator++() { ++m_index; ++m_it; return *this; }
Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }