From 56ce8c3f9c88a8067072a6cafe2cb7ef58b6fd93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Masiukiewicz?= Date: Tue, 4 Oct 2022 22:18:45 +0200 Subject: [PATCH] Don't use ForeachType as it don't work if foreach type is not copyable. This fixes compilation error: include/d/std/traits.d:8024: Error: Generating an `inout` copy constructor for `struct game.graphic.manager.Graphic` failed, therefore instances of it are uncopyable --- source/bubel/ecs/manager.d | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/bubel/ecs/manager.d b/source/bubel/ecs/manager.d index 32ba65d..fb43f67 100644 --- a/source/bubel/ecs/manager.d +++ b/source/bubel/ecs/manager.d @@ -465,7 +465,7 @@ export struct EntityManager static if (isArray!MemberType) { // Workaround. This code is never called with: not an array type, but compiler prints an error // name = fullyQualifiedName!(Unqual!(ForeachType!MemberType));//.stringof; - name = fullName!(Unqual!(ForeachType!MemberType)); + name = fullName!(Unqual!(typeof(MemberType.init[0]))); } bool is_optional; @@ -691,7 +691,7 @@ export struct EntityManager static if (isArray!MemberType) { // Workaround. This code is never called with: not an array type, but compiler prints an error // name = fullyQualifiedName!(Unqual!(ForeachType!MemberType)); - name = fullName!(Unqual!(ForeachType!MemberType)); + name = fullName!(Unqual!(typeof(MemberType.init[0]))); //name = Unqual!(ForeachType!MemberType).stringof; } @@ -899,10 +899,12 @@ export struct EntityManager static foreach (iii, comp_info; components_info.m_req[0 .. components_info.m_req_counter]) { - __traits(getMember, input_data, comp_info.name) = (cast(ForeachType!(typeof(__traits(getMember, - Sys.EntitiesData, comp_info.name)))*)( - cast(void*) block + info.deltas[system.m_components[iii]]))[offset - .. entities_count]; + __traits(getMember, input_data, comp_info.name) = ( + cast(typeof( + (typeof(__traits(getMember, Sys.EntitiesData, comp_info.name))).init[0] + )*) + (cast(void*) block + info.deltas[system.m_components[iii]]) + )[offset .. entities_count]; } static foreach (iii, comp_info; components_info.m_optional[0