From 4f3f21f72602ab4ce49caa6e7264d369afc98977 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 18 May 2026 18:55:12 +0200 Subject: Particle --- lib/core/c++/iterator.hpp | 28 ++++++++++++++++++++++++++++ lib/core/c++/particle/particle.hpp | 7 +++++++ lib/core/tests/iterator.cpp | 17 +++++++++++++++++ 3 files changed, 52 insertions(+) (limited to 'lib') diff --git a/lib/core/c++/iterator.hpp b/lib/core/c++/iterator.hpp index 866543a..696c521 100644 --- a/lib/core/c++/iterator.hpp +++ b/lib/core/c++/iterator.hpp @@ -50,6 +50,34 @@ public: } }; +template +struct ct_tuple_iterator final { +private: + template + static constexpr saw::error_or apply_i( + Func& func, + saw::data>& tup + ){ + if constexpr ( i < sizeof...(Tup) ){ + auto eov = func(tup.template get()); + if(eov.is_error()){ + return eov; + } + return apply_i(func,tup); + } + + return saw::make_void(); + } +public: + template + static constexpr saw::error_or apply( + Func&& func, + saw::data>& tup + ){ + return apply_i(func,tup); + } +}; + /* Ambiguous template void iterate_over(Func&& func, const saw::data>& start, const saw::data>& end, const saw::data>& dist = {{{0u,0u,0u}}}){ diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index 7af43dc..01429b2 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -238,5 +238,12 @@ constexpr auto broadphase_collision_check = []( ) -> bool{ return broadphase_collision_distance_squared(left,coll_l,right,coll_r).first; }; + + + +namespace impl { + +} + } } diff --git a/lib/core/tests/iterator.cpp b/lib/core/tests/iterator.cpp index 261765a..919c12c 100644 --- a/lib/core/tests/iterator.cpp +++ b/lib/core/tests/iterator.cpp @@ -20,6 +20,23 @@ SAW_TEST("Old Iterate"){ }, start, end); } +SAW_TEST("CT Tuple Iterator"){ + using namespace kel; + + saw::data< + sch::Tuple< + sch::Float32, + sch::Int16, + sch::Float64, + sch::UInt32 + > + > tup; + + lbm::ct_tuple_iterator::Schema>::apply([](auto& val) -> saw::error_or { + return saw::make_void(); + },tup); +} + SAW_TEST("Old Iterate with Distance 1"){ using namespace kel; -- cgit v1.2.3