#pragma once #include "data.hpp" namespace saw { namespace impl { template struct iterator_index_parameter_value { static_assert(i > 0, "Shouldn't happen"); static constexpr uint64_t value = iterator_index_parameter_value::value; }; template struct iterator_index_parameter_value<0u, val_0, vals...> { static constexpr uint64_t value = val_0; }; template struct iterator_in_bounds { private: static constexpr std::array dims_{Dims...}; template static error_or apply_i(Func& func, data, encode::Native>& index){ if constexpr (level >= sizeof...(Dims)){ return func(index); }else{ index.at({level}).set(0); for(;index.at({level}).get() < impl::iterator_index_parameter_value::value; ++index.at({level})){ auto eov = apply_i(func, index); if(eov.is_error()){ return eov; } } } return saw::make_void(); } public: static error_or apply(Func& func){ data, encode::Native> index; return apply_i<0u>(func, index); } }; } template struct rank_iterator { template static error_or in_fixed_bounds(Func&& func){ // static_assert(D == 2u, "Currently a lazy implementation for AND combinations of intervalls."); return impl::iterator_in_bounds::apply(func); } }; }