From 0f7deb11163909e68623bd689c275613f9368391 Mon Sep 17 00:00:00 2001 From: ubpa Date: Thu, 18 Mar 2021 22:44:47 +0800 Subject: [PATCH] use small_flat_set --- include/UECS/AccessTypeID.h | 4 ++-- include/UECS/ArchetypeFilter.h | 4 +--- include/UECS/Schedule.h | 4 ++-- include/UECS/details/TypeIDSet.h | 6 +----- src/app/CmptHashCode/main.cpp | 2 +- src/test/12_framegraph/main.cpp | 11 +---------- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/include/UECS/AccessTypeID.h b/include/UECS/AccessTypeID.h index 26cb95a..38e7e9f 100644 --- a/include/UECS/AccessTypeID.h +++ b/include/UECS/AccessTypeID.h @@ -6,7 +6,7 @@ #include -#include +#include namespace Ubpa::UECS { // TypeID with AccessMode @@ -28,7 +28,7 @@ namespace Ubpa::UECS { template static constexpr AccessTypeID AccessTypeID_of = { TypeID_of>, AccessMode_of }; - using AccessTypeIDSet = std::set>; + using AccessTypeIDSet = small_flat_set>; } template<> diff --git a/include/UECS/ArchetypeFilter.h b/include/UECS/ArchetypeFilter.h index 5052b5c..929f408 100644 --- a/include/UECS/ArchetypeFilter.h +++ b/include/UECS/ArchetypeFilter.h @@ -2,14 +2,12 @@ #include "AccessTypeID.h" -#include - namespace Ubpa::UECS { // filter Archetype with all, any and none struct ArchetypeFilter { AccessTypeIDSet all; AccessTypeIDSet any; - std::set none; + small_flat_set none; std::size_t GetValue() const noexcept; diff --git a/include/UECS/Schedule.h b/include/UECS/Schedule.h index dbdef9c..1d7f4a5 100644 --- a/include/UECS/Schedule.h +++ b/include/UECS/Schedule.h @@ -108,8 +108,8 @@ namespace Ubpa::UECS { std::unordered_map sysFuncOrder; struct FilterChange { - std::set insertNones; - std::set eraseNones; + small_flat_set insertNones; + small_flat_set eraseNones; }; std::unordered_map sysFilterChange; diff --git a/include/UECS/details/TypeIDSet.h b/include/UECS/details/TypeIDSet.h index 234d5ea..d2c52d7 100644 --- a/include/UECS/details/TypeIDSet.h +++ b/include/UECS/details/TypeIDSet.h @@ -2,13 +2,9 @@ #include "../EntityQuery.h" -#include - -#include - namespace Ubpa::UECS { struct TypeIDSet { - std::set data; + small_flat_set data; std::size_t GetValue() const noexcept; diff --git a/src/app/CmptHashCode/main.cpp b/src/app/CmptHashCode/main.cpp index 553c231..b25ff3d 100644 --- a/src/app/CmptHashCode/main.cpp +++ b/src/app/CmptHashCode/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/src/test/12_framegraph/main.cpp b/src/test/12_framegraph/main.cpp index fc46aa6..d571e96 100644 --- a/src/test/12_framegraph/main.cpp +++ b/src/test/12_framegraph/main.cpp @@ -31,18 +31,9 @@ struct MySystem { int main() { World w; + w.entityMngr.cmptTraits.Register(); w.systemMngr.RegisterAndActivate(); - w.entityMngr.cmptTraits - .RegisterName(Type_of) - .RegisterName(Type_of) - .RegisterName(Type_of) - .RegisterName(Type_of) - .RegisterName(Type_of) - .RegisterName(Type_of) - .RegisterName(Type_of) - ; - w.entityMngr.Create(Ubpa::TypeIDs_of); w.Update();