diff --git a/libs/ecs/include/psemek/ecs/detail/apply_helper.hpp b/libs/ecs/include/psemek/ecs/detail/apply_helper.hpp index 17ba12bf..e878d7b8 100644 --- a/libs/ecs/include/psemek/ecs/detail/apply_helper.hpp +++ b/libs/ecs/include/psemek/ecs/detail/apply_helper.hpp @@ -43,19 +43,19 @@ namespace psemek::ecs::detail if constexpr (std::invocable, util::span ...>) { - function(parent, handles_span, util::span{components, count} ...); + function(parent, handles_span, util::span{components, is_empty_v ? 1 : count} ...); } else if constexpr (std::invocable, util::span ...>) { - function(handles_span, util::span{components, count} ...); + function(handles_span, util::span{components, is_empty_v ? 1 : count} ...); } else if constexpr (std::invocable ...>) { - function(parent, util::span{components, count} ...); + function(parent, util::span{components, is_empty_v ? 1 : count} ...); } else { - function(util::span{components, count} ...); + function(util::span{components, is_empty_v ? 1 : count} ...); } } diff --git a/libs/ecs/include/psemek/ecs/entity_container.hpp b/libs/ecs/include/psemek/ecs/entity_container.hpp index 8b04a3f9..4a66bf33 100644 --- a/libs/ecs/include/psemek/ecs/entity_container.hpp +++ b/libs/ecs/include/psemek/ecs/entity_container.hpp @@ -126,6 +126,9 @@ namespace psemek::ecs * void(span, span...) * void(entity_container, span...) * void(entity_container, span, span...) + * The size of all spans within a single function call are the same, + * except for empty component types (i.e. std::is_empty_v is true), + * each having an unspecified non-zero size. * An optional query cache can be supplied to speed up iteration. * If the query cache wasn't created with the exact sequence of component * types, the behavior is undefined.