summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/collections.h10
-rw-r--r--lib/util.h8
2 files changed, 11 insertions, 7 deletions
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<TriangleTriplesImpl> {
+inline constexpr auto dereference = std::views::transform([](const auto & iter) -> decltype(auto) {
+ return *iter;
+});
+
+struct TriangleTriples : public std::ranges::range_adaptor_closure<TriangleTriples> {
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<typename T, typename Dist, typename Merger>
void
diff --git a/lib/util.h b/lib/util.h
index 2674eaf..cd7971b 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -29,7 +29,7 @@ namespace {
};
}
-template<size_t... N> constexpr auto Nth = GetNth<N...> {};
-constexpr auto GetFirst = Nth<0>;
-constexpr auto GetSecond = Nth<1>;
-constexpr auto GetSwapped = Nth<0, 1>;
+template<size_t... N> inline constexpr auto Nth = GetNth<N...> {};
+inline constexpr auto GetFirst = Nth<0>;
+inline constexpr auto GetSecond = Nth<1>;
+inline constexpr auto GetSwapped = Nth<0, 1>;