Skip to content

Commit

Permalink
use small_flat_set
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubpa committed Mar 18, 2021
1 parent d12d995 commit 0f7deb1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 23 deletions.
4 changes: 2 additions & 2 deletions include/UECS/AccessTypeID.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <UTemplate/Type.hpp>

#include <set>
#include <USmallFlat/small_flat_set.hpp>

namespace Ubpa::UECS {
// TypeID with AccessMode
Expand All @@ -28,7 +28,7 @@ namespace Ubpa::UECS {
template<typename Cmpt>
static constexpr AccessTypeID AccessTypeID_of = { TypeID_of<RemoveTag_t<Cmpt>>, AccessMode_of<Cmpt> };

using AccessTypeIDSet = std::set<AccessTypeID, std::less<>>;
using AccessTypeIDSet = small_flat_set<AccessTypeID, 16, std::less<>>;
}

template<>
Expand Down
4 changes: 1 addition & 3 deletions include/UECS/ArchetypeFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

#include "AccessTypeID.h"

#include <set>

namespace Ubpa::UECS {
// filter Archetype with all, any and none
struct ArchetypeFilter {
AccessTypeIDSet all;
AccessTypeIDSet any;
std::set<TypeID> none;
small_flat_set<TypeID> none;

std::size_t GetValue() const noexcept;

Expand Down
4 changes: 2 additions & 2 deletions include/UECS/Schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ namespace Ubpa::UECS {
std::unordered_map<std::size_t, std::size_t> sysFuncOrder;

struct FilterChange {
std::set<TypeID> insertNones;
std::set<TypeID> eraseNones;
small_flat_set<TypeID> insertNones;
small_flat_set<TypeID> eraseNones;
};
std::unordered_map<std::size_t, FilterChange> sysFilterChange;

Expand Down
6 changes: 1 addition & 5 deletions include/UECS/details/TypeIDSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

#include "../EntityQuery.h"

#include <span>

#include <set>

namespace Ubpa::UECS {
struct TypeIDSet {
std::set<TypeID> data;
small_flat_set<TypeID> data;

std::size_t GetValue() const noexcept;

Expand Down
2 changes: 1 addition & 1 deletion src/app/CmptHashCode/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <UTemplate/Type.h>
#include <UTemplate/Type.hpp>

#include <iostream>

Expand Down
11 changes: 1 addition & 10 deletions src/test/12_framegraph/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,9 @@ struct MySystem {

int main() {
World w;
w.entityMngr.cmptTraits.Register<A, B, C, D, E, F, G>();
w.systemMngr.RegisterAndActivate<MySystem>();

w.entityMngr.cmptTraits
.RegisterName(Type_of<A>)
.RegisterName(Type_of<B>)
.RegisterName(Type_of<C>)
.RegisterName(Type_of<D>)
.RegisterName(Type_of<E>)
.RegisterName(Type_of<F>)
.RegisterName(Type_of<G>)
;

w.entityMngr.Create(Ubpa::TypeIDs_of<A, B, C, D, E>);
w.Update();

Expand Down

0 comments on commit 0f7deb1

Please sign in to comment.