#pragma once #include "common.hpp" #include "chunk.hpp" namespace kel { namespace lbm { namespace impl { template struct memory_size_helper; template struct memory_size_helper> { static constexpr uint64_t bytes = N; }; template struct memory_size_helper> { static constexpr uint64_t bytes = saw::ct_multiply::value * memory_size_helper::bytes; }; template struct memory_size_helper> { static constexpr uint64_t bytes = memory_size_helper::InnerSchema>::bytes; }; template class memory_estimate_helper final { private: template static void apply_i(saw::data& bytes){ if constexpr ( i < sizeof...(T)){ using T_I = typename saw::parameter_pack_type::type; bytes.set(bytes.get() + memory_size_helper::bytes); apply_i(bytes); } } public: static void apply(saw::data& bytes){ apply_i<0u>(bytes); } }; } template saw::data memory_estimate(){ saw::data bytes; impl::memory_estimate_helper::apply(bytes); return bytes; } } }