Michele Caini 4 лет назад
Родитель
Сommit
87bc2cb1ab
4 измененных файлов с 8 добавлено и 8 удалено
  1. 2 2
      docs/md/core.md
  2. 2 2
      src/entt/core/any.hpp
  3. 2 2
      test/entt/core/any.cpp
  4. 2 2
      test/entt/meta/meta_any.cpp

+ 2 - 2
docs/md/core.md

@@ -181,10 +181,10 @@ const std::size_t hash = any.hash();
 However, there are some limitations:
 
 * The instance of `any` **must** not be empty, otherwise the returned value is
-  that of `std::hash<std::nullptr_t>{}({})`.
+  that of `std::hash<const void *>{}(nullptr)`.
 
 * The underlying object **must** support this operation, otherwise the returned
-  value is that of `std::hash<std::nullptr_t>{}({})`.
+  value is that of `std::hash<const void *>{}(nullptr)`.
 
 Unfortunately, it's not possible to trigger a compile-time error in these cases.
 This would prevent users from using non-hashable types with `any`.<br/>

+ 2 - 2
src/entt/core/any.hpp

@@ -395,14 +395,14 @@ public:
      * returned once converted to `const void *`.
      *
      * @return The hash value of the contained object or its address if any,
-     * `std::hash<std::nullptr_t>{}({})` otherwise.
+     * `std::hash<const void *>{}({})` otherwise.
      */
     [[nodiscard]] std::size_t hash() const ENTT_NOEXCEPT {
         if(std::size_t value{}; vtable && vtable(operation::hash, *this, &value)) {
             return value;
         }
 
-        return std::hash<std::nullptr_t>{}({});
+        return std::hash<const void *>{}(nullptr);
     }
 
 private:

+ 2 - 2
test/entt/core/any.cpp

@@ -1192,8 +1192,8 @@ TEST_F(Any, NotHashable) {
     ASSERT_TRUE(any);
     ASSERT_TRUE(ref);
 
-    ASSERT_EQ(any.hash(), std::hash<std::nullptr_t>{}({}));
-    ASSERT_EQ(std::hash<std::nullptr_t>{}({}), std::hash<entt::any>{}(ref));
+    ASSERT_EQ(any.hash(), std::hash<const void *>{}(nullptr));
+    ASSERT_EQ(std::hash<const void *>{}(nullptr), std::hash<entt::any>{}(ref));
     ASSERT_EQ(ref.hash(), std::hash<entt::any>{}(any));
     ASSERT_EQ(any.hash(), entt::any{}.hash());
 }

+ 2 - 2
test/entt/meta/meta_any.cpp

@@ -1097,8 +1097,8 @@ TEST_F(MetaAny, NotHashable) {
     ASSERT_TRUE(any);
     ASSERT_TRUE(ref);
 
-    ASSERT_EQ(any.hash(), std::hash<std::nullptr_t>{}({}));
-    ASSERT_EQ(std::hash<std::nullptr_t>{}({}), std::hash<entt::any>{}(ref));
+    ASSERT_EQ(any.hash(), std::hash<const void *>{}(nullptr));
+    ASSERT_EQ(std::hash<const void *>{}(nullptr), std::hash<entt::any>{}(ref));
     ASSERT_EQ(ref.hash(), std::hash<entt::any>{}(any));
     ASSERT_EQ(any.hash(), entt::any{}.hash());
 }