]> code.bitgloo.com Git - clyne/entityx.git/commitdiff
fix difference_type; fix benchmark warnings remove-std-iterator
authorClyne Sullivan <clyne@bitgloo.com>
Sat, 20 Aug 2022 00:51:34 +0000 (20:51 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Sat, 20 Aug 2022 00:51:34 +0000 (20:51 -0400)
entityx/Benchmarks_test.cc
entityx/Entity.h

index 2c30e176a1f182da46e3807fc58d65dca9b150a2..deb4bb3e36cd0748869adb9c5071849d90ce3c81 100644 (file)
@@ -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>();
index 3a708396d82a7d9f762366adb37b49db38b09783..418523de0f212b9a15d6963aa49cb87246098e36 100644 (file)
@@ -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&;