From f26559dcd25b649d37a1a30e087b70b95f530954 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Feb 2025 23:53:46 +0000 Subject: Range adaptor to make triangle strip triples --- lib/collections.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'lib') diff --git a/lib/collections.h b/lib/collections.h index fcd65d3..c81bede 100644 --- a/lib/collections.h +++ b/lib/collections.h @@ -197,6 +197,14 @@ template struct stripiter { return *this; } + constexpr stripiter + operator++(int) + { + auto out {*this}; + ++*this; + return out; + } + constexpr stripiter & operator--() { @@ -205,6 +213,14 @@ template struct stripiter { return *this; } + constexpr stripiter + operator--(int) + { + auto out {*this}; + --*this; + return out; + } + constexpr auto operator-(const stripiter & other) const { @@ -235,6 +251,16 @@ strip_end(IterableCollection auto & cont) return stripiter {cont.end()}; } +struct TriangleTriplesImpl : public std::ranges::range_adaptor_closure { + decltype(auto) + operator()(const auto & triangleStrip) const + { + return std::views::iota(strip_begin(triangleStrip), strip_end(triangleStrip)); + } +}; + +constexpr TriangleTriplesImpl TriangleTriples; + template void mergeClose(std::vector & range, const Dist & dist, const Merger & merger, -- cgit v1.2.3