Michele Caini 7 лет назад
Родитель
Сommit
76eab21738
5 измененных файлов с 12 добавлено и 11 удалено
  1. 2 5
      TODO
  2. 3 0
      appveyor.yml
  3. 2 2
      src/entt/signal/delegate.hpp
  4. 1 1
      src/entt/signal/sigh.hpp
  5. 4 3
      test/entt/signal/sigh.cpp

+ 2 - 5
TODO

@@ -9,6 +9,7 @@
 * runner proposal: https://en.wikipedia.org/wiki/Fork%E2%80%93join_model https://slide-rs.github.io/specs/03_dispatcher.html
 * is it possible to iterate all the components assigned to an entity through a common base class?
 * work stealing job system (see #100)
+* can we do more for shared libraries? who knows... see #144
 * meta: sort of meta view based on meta stuff to iterate entities, void * and meta info objects
 * meta: move-to-head optimization when searching by name on parts (data, func, etc)
 * hashed string: add implicit check on construction for uniqueness (optional)
@@ -21,11 +22,7 @@
 * events on replace, so that one can track updated components? indagate impact
 * tags revenge: if it's possible, reintroduce them but without a link to entities (see #169 for more details)
 
-Required test:
-* can we do more for shared libraries? who knows... see #144
-* type_info::hash_code can be used in place of family when it comes to working with dlls
-
 Ready to go:
 * stealing archetype-like model on top of EnTT (design completed, wip dev)
 * write/show how to create an archetype based model on top of EnTT
-* do not include it in EnTT, it breaks the pay-for-what-you-use principle all the ways
+* note: do not include it in EnTT, it breaks the pay-for-what-you-use principle all the ways

+ 3 - 0
appveyor.yml

@@ -16,6 +16,9 @@ before_build:
   - cd %BUILD_DIR%
   - cmake .. -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS=/W1 -G"Visual Studio 15 2017"
 
+after_build:
+  - ctest -C Release -j4
+
 build:
   parallel: true
   project: build/entt.sln

+ 2 - 2
src/entt/signal/delegate.hpp

@@ -225,8 +225,8 @@ public:
      * @return True if the two delegates are identical, false otherwise.
      */
     bool operator==(const delegate<Ret(Args...)> &other) const ENTT_NOEXCEPT {
-        const char *lhs = reinterpret_cast<const char *>(&storage);
-        const char *rhs = reinterpret_cast<const char *>(&other.storage);
+        auto *lhs = reinterpret_cast<const unsigned char *>(&storage);
+        auto *rhs = reinterpret_cast<const unsigned char *>(&other.storage);
         return fn == other.fn && std::equal(lhs, lhs + sizeof(storage_type), rhs);
     }
 

+ 1 - 1
src/entt/signal/sigh.hpp

@@ -351,7 +351,7 @@ struct sigh<Ret(Args...), Collector> final: private internal::invoker<Ret(Args..
      * @return True if the two signals are identical, false otherwise.
      */
     bool operator==(const sigh &other) const ENTT_NOEXCEPT {
-        return std::equal(calls.cbegin(), calls.cend(), other.calls.cbegin(), other.calls.cend());
+        return calls == other.calls;
     }
 
 private:

+ 4 - 3
test/entt/signal/sigh.cpp

@@ -10,7 +10,8 @@ struct sigh_listener {
     bool h(const int &) { return k; }
 
     void i() {}
-    void l() {}
+    // useless definition just because msvc does weird things if both are empty
+    void l() { k = k ? true : false; }
 
     bool k{false};
 };
@@ -19,7 +20,7 @@ template<typename Ret>
 struct test_collect_all {
     std::vector<Ret> vec{};
     static int f() { return 42; }
-    static int g() { return 42; }
+    static int g() { return 3; }
     bool operator()(Ret r) noexcept {
         vec.push_back(r);
         return true;
@@ -215,7 +216,7 @@ TEST(SigH, Collector) {
     ASSERT_FALSE(collector_all.vec.empty());
     ASSERT_EQ(static_cast<std::vector<int>::size_type>(2), collector_all.vec.size());
     ASSERT_EQ(42, collector_all.vec[0]);
-    ASSERT_EQ(42, collector_all.vec[1]);
+    ASSERT_EQ(3, collector_all.vec[1]);
 
     entt::sigh<int(), test_collect_first<int>> sigh_first;