浏览代码

handle: extended operator==/!=

Michele Caini 4 年之前
父节点
当前提交
f26fa92d47
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      src/entt/entity/handle.hpp

+ 8 - 6
src/entt/entity/handle.hpp

@@ -289,28 +289,30 @@ private:
 
 
 /**
 /**
  * @brief Compares two handles.
  * @brief Compares two handles.
- * @tparam Args Template parameters of the handles to compare.
+ * @tparam Args Scope of the first handle.
+ * @tparam Other Scope of the second handle.
  * @param lhs A valid handle.
  * @param lhs A valid handle.
  * @param rhs A valid handle.
  * @param rhs A valid handle.
  * @return True if both handles refer to the same registry and the same
  * @return True if both handles refer to the same registry and the same
  * entity, false otherwise.
  * entity, false otherwise.
  */
  */
-template<typename... Args>
-[[nodiscard]] bool operator==(const basic_handle<Args...> &lhs, const basic_handle<Args...> &rhs) ENTT_NOEXCEPT {
+template<typename... Args, typename... Other>
+[[nodiscard]] bool operator==(const basic_handle<Args...> &lhs, const basic_handle<Other...> &rhs) ENTT_NOEXCEPT {
     return lhs.registry() == rhs.registry() && lhs.entity() == rhs.entity();
     return lhs.registry() == rhs.registry() && lhs.entity() == rhs.entity();
 }
 }
 
 
 
 
 /**
 /**
  * @brief Compares two handles.
  * @brief Compares two handles.
- * @tparam Args Template parameters of the handles to compare.
+ * @tparam Args Scope of the first handle.
+ * @tparam Other Scope of the second handle.
  * @param lhs A valid handle.
  * @param lhs A valid handle.
  * @param rhs A valid handle.
  * @param rhs A valid handle.
  * @return False if both handles refer to the same registry and the same
  * @return False if both handles refer to the same registry and the same
  * entity, true otherwise.
  * entity, true otherwise.
  */
  */
-template<typename... Args>
-[[nodiscard]] bool operator!=(const basic_handle<Args...> &lhs, const basic_handle<Args...> &rhs) ENTT_NOEXCEPT {
+template<typename... Args, typename... Other>
+[[nodiscard]] bool operator!=(const basic_handle<Args...> &lhs, const basic_handle<Other...> &rhs) ENTT_NOEXCEPT {
     return !(lhs == rhs);
     return !(lhs == rhs);
 }
 }