From 619983e949fde226cc7a3de0bc198fdcee3fe3b4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 15 Feb 2025 14:46:48 +0000 Subject: Fixes and tests to new range helpers --- lib/collections.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/collections.h') diff --git a/lib/collections.h b/lib/collections.h index c81bede..27eff0a 100644 --- a/lib/collections.h +++ b/lib/collections.h @@ -251,15 +251,19 @@ strip_end(IterableCollection auto & cont) return stripiter {cont.end()}; } -struct TriangleTriplesImpl : public std::ranges::range_adaptor_closure { +inline constexpr auto dereference = std::views::transform([](const auto & iter) -> decltype(auto) { + return *iter; +}); + +struct TriangleTriples : public std::ranges::range_adaptor_closure { decltype(auto) operator()(const auto & triangleStrip) const { - return std::views::iota(strip_begin(triangleStrip), strip_end(triangleStrip)); + return std::views::iota(strip_begin(triangleStrip), strip_end(triangleStrip)) | dereference; } }; -constexpr TriangleTriplesImpl TriangleTriples; +inline constexpr TriangleTriples triangleTriples; template void -- cgit v1.2.3