diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2022-08-19 20:51:34 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2022-08-19 20:51:34 -0400 |
commit | 39e07099da7227d7d7baec072411ddc0abfd8be4 (patch) | |
tree | df601c36539259d4cd243c8acc3e4f93124056c8 | |
parent | c6ce70f1d5dd12daaf543070584cb3ed96dc3b1e (diff) |
fix difference_type; fix benchmark warningsremove-std-iterator
-rw-r--r-- | entityx/Benchmarks_test.cc | 20 | ||||
-rw-r--r-- | entityx/Entity.h | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/entityx/Benchmarks_test.cc b/entityx/Benchmarks_test.cc index 2c30e17..deb4bb3 100644 --- a/entityx/Benchmarks_test.cc +++ b/entityx/Benchmarks_test.cc @@ -33,8 +33,8 @@ struct Listener : public Receiver<Listener> { void receive(const EntityCreatedEvent &event) { ++created; } void receive(const EntityDestroyedEvent &event) { ++destroyed; } - int created = 0; - int destroyed = 0; + long unsigned int created = 0; + long unsigned int destroyed = 0; }; struct Position : public Component<Position> { @@ -84,13 +84,13 @@ TEST_CASE_METHOD(BenchmarkFixture, "TestCreateEntitiesWithListener") { Listener listen; ev.subscribe<EntityCreatedEvent>(listen); - int count = 10000000L; + long unsigned int count = 10000000L; AutoTimer t; cout << "creating " << count << " entities while notifying a single EntityCreatedEvent listener" << endl; vector<Entity> entities; - for (int i = 0; i < count; i++) { + for (long unsigned int i = 0; i < count; i++) { entities.push_back(em.create()); } @@ -99,9 +99,9 @@ TEST_CASE_METHOD(BenchmarkFixture, "TestCreateEntitiesWithListener") { } TEST_CASE_METHOD(BenchmarkFixture, "TestDestroyEntitiesWithListener") { - int count = 10000000; + long unsigned int count = 10000000; vector<Entity> entities; - for (int i = 0; i < count; i++) { + for (long unsigned int i = 0; i < count; i++) { entities.push_back(em.create()); } @@ -120,8 +120,8 @@ TEST_CASE_METHOD(BenchmarkFixture, "TestDestroyEntitiesWithListener") { } TEST_CASE_METHOD(BenchmarkFixture, "TestEntityIteration") { - int count = 10000000; - for (int i = 0; i < count; i++) { + long unsigned int count = 10000000; + for (long unsigned int i = 0; i < count; i++) { auto e = em.create(); e.assign<Position>(); } @@ -136,8 +136,8 @@ TEST_CASE_METHOD(BenchmarkFixture, "TestEntityIteration") { } TEST_CASE_METHOD(BenchmarkFixture, "TestEntityIterationUnpackTwo") { - int count = 10000000; - for (int i = 0; i < count; i++) { + long unsigned int count = 10000000; + for (long unsigned int i = 0; i < count; i++) { auto e = em.create(); e.assign<Position>(); e.assign<Direction>(); diff --git a/entityx/Entity.h b/entityx/Entity.h index 3a70839..418523d 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -371,7 +371,7 @@ class EntityManager : entityx::help::NonCopyable { public: using iterator_category = std::input_iterator_tag; using value_type = Entity::Id; - using difference_type = Entity::Id; + using difference_type = int; using pointer = const Entity::Id*; using reference = const Entity::Id&; |