From 4f53537d27a2221ca73e08370ca03c4a13efa007 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 23 Jul 2021 23:28:44 +0300 Subject: [PATCH] Support non-default-constructible per-species component types in util::ecs --- libs/util/include/psemek/util/ecs.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/util/include/psemek/util/ecs.hpp b/libs/util/include/psemek/util/ecs.hpp index d652b1f4..dc0dff52 100644 --- a/libs/util/include/psemek/util/ecs.hpp +++ b/libs/util/include/psemek/util/ecs.hpp @@ -53,7 +53,7 @@ namespace psemek::util template void apply(Behavior & behavior) { - apply_impl(behavior, typename Behavior::component_types{}); + apply_impl(behavior, static_cast(nullptr), std::make_index_sequence>{}); } virtual ~species_base() {} @@ -65,12 +65,12 @@ namespace psemek::util private: - template - void apply_impl(Behavior & behavior, std::tuple) + template + void apply_impl(Behavior & behavior, std::tuple *, std::index_sequence) { std::tuple cptrs; - ((std::get(cptrs) = get_entity_component()), ...); + ((std::get(cptrs) = get_entity_component()), ...); auto all_nonzero = [](auto * ... ptrs) {