Просмотр исходного кода

resource: fix undefined behavior in comparison operators (#1344)

Tyler Chamberlain 3 недель назад
Родитель
Сommit
4a583ebec3
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/entt/resource/resource.hpp

+ 2 - 2
src/entt/resource/resource.hpp

@@ -168,7 +168,7 @@ public:
      */
     template<typename Other>
     [[nodiscard]] bool operator==(const resource<Other> &other) const noexcept {
-        return (stl::addressof(*value) == stl::addressof(*other.value));
+        return (value == other.value);
     }
 
     /**
@@ -179,7 +179,7 @@ public:
      */
     template<typename Other>
     [[nodiscard]] auto operator<=>(const resource<Other> &other) const noexcept {
-        return (stl::addressof(*value) <=> stl::addressof(*other.value));
+        return (value <=> other.value);
     }
 
     /*! @brief Releases the ownership of the managed resource. */