From b00a74f431c1a430354ee47dcb50beb1efb09044 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Wed, 9 Nov 2022 17:45:49 +0300 Subject: [PATCH] Fix initializing ecs species components --- libs/util/include/psemek/util/ecs.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/util/include/psemek/util/ecs.hpp b/libs/util/include/psemek/util/ecs.hpp index ba82cabc..3752fe7b 100644 --- a/libs/util/include/psemek/util/ecs.hpp +++ b/libs/util/include/psemek/util/ecs.hpp @@ -304,9 +304,10 @@ namespace psemek::util struct species_impl_base : species_base { - species_impl_base(ecs * ecs, std::string name, species_handle id, Components && ... components) + template + species_impl_base(ecs * ecs, std::string name, species_handle id, Args && ... components) : species_base(ecs, std::move(name), id) - , species_components_{std::move(components)...} + , species_components_{std::forward(components)...} {} using species_base::get_species_component; @@ -720,9 +721,9 @@ namespace psemek::util { species_handle result{species_.size()}; if (p == policy::sparse) - species_.push_back(std::make_unique>(this, std::move(name), result.value, std::move(components)...)); + species_.push_back(std::make_unique...>>(this, std::move(name), result.value, std::forward(components)...)); else - species_.push_back(std::make_unique>(this, std::move(name), result.value, std::move(components)...)); + species_.push_back(std::make_unique...>>(this, std::move(name), result.value, std::forward(components)...)); for (auto const & ctor : species_constructors_) ctor(result); return result;