diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-05 13:38:04 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-05 13:38:04 +0100 |
| commit | b9aacd9c2fdc61721c8ca3e1b40ebc92daa3772e (patch) | |
| tree | bec510bca7b72b8fe63b7f8cec1fd78b7ff03bc2 /lib/c++/iterator.hpp | |
| parent | f5c40005f576b5a3416c2cda8c60e5f100810ddb (diff) | |
| download | libs-lbm-b9aacd9c2fdc61721c8ca3e1b40ebc92daa3772e.tar.gz | |
Reworking structure
Diffstat (limited to 'lib/c++/iterator.hpp')
| -rw-r--r-- | lib/c++/iterator.hpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/lib/c++/iterator.hpp b/lib/c++/iterator.hpp deleted file mode 100644 index 866543a..0000000 --- a/lib/c++/iterator.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include "descriptor.hpp" - -namespace kel { -namespace lbm { -template<typename Func> -void iterate_over(Func&& func, const saw::data<sch::FixedArray<sch::UInt64,2u>>& start, const saw::data<sch::FixedArray<sch::UInt64,2u>>& end, const saw::data<sch::FixedArray<sch::UInt64,2u>>& dist = {{{0u,0u}}}){ - // static_assert(D == 2u, "Currently a lazy implementation for AND combinations of intervalls."); - for(saw::data<sch::UInt64> i{start.at({0u}) + dist.at({0u})}; (i+dist.at({0u})) < end.at({0u}); ++i){ - for(saw::data<sch::UInt64> j{start.at({1u}) + dist.at({1u})}; (j+dist.at({1u})) < end.at({1u}); ++j){ - func({{i,j}}); - } - } - return; -} - -/** - * - */ -template<uint64_t D> -struct iterator { -private: - template<uint64_t i, typename Func> - static void iterate_over_i(Func& func, - const saw::data<sch::FixedArray<sch::UInt64,D>>& start, - const saw::data<sch::FixedArray<sch::UInt64,D>>& end, - const saw::data<sch::FixedArray<sch::UInt64,D>>& dist, - saw::data<sch::FixedArray<sch::UInt64,D>>& iter - ){ - static_assert(i <= D, "Eh. Too tired to think of a good message"); - if constexpr ( i == D ){ - func(iter); - }else{ - for(iter.at({i}) = start.at({i})+dist.at({i}); (iter.at({i})+dist.at({i}) < end.at({i})); ++iter.at({i})){ - iterate_over_i<i+1u,Func>(func,start,end,dist,iter); - } - } - } -public: - template<typename Func> - static void apply( - Func&& func, - const saw::data<sch::FixedArray<sch::UInt64,D>>& start, - const saw::data<sch::FixedArray<sch::UInt64,D>>& end, - const saw::data<sch::FixedArray<sch::UInt64,D>>& dist = {} - ){ - saw::data<sch::FixedArray<sch::UInt64,D>> iter; - iterate_over_i<0u,Func>(func, start, end, dist, iter); - } -}; - -/* Ambiguous -template<typename Func> -void iterate_over(Func&& func, const saw::data<sch::FixedArray<sch::UInt64,3u>>& start, const saw::data<sch::FixedArray<sch::UInt64,3u>>& end, const saw::data<sch::FixedArray<sch::UInt64,3u>>& dist = {{{0u,0u,0u}}}){ - // static_assert(D == 2u, "Currently a lazy implementation for AND combinations of intervalls."); - for(saw::data<sch::UInt64> i{start.at({0u}) + dist.at({0u})}; (i+dist.at({0u})) < end.at({0u}); ++i){ - for(saw::data<sch::UInt64> j{start.at({1u}) + dist.at({1u})}; (j+dist.at({1u})) < end.at({1u}); ++j){ - for(saw::data<sch::UInt64> k{start.at({2u}) + dist.at({2u})}; (j+dist.at({2u})) < end.at({2u}); ++j){ - func({{k,j,i}}); - } - } - } - return; -} -*/ -} -} |
