Ver código fonte

entity:
* Updated doc
* No const-ref for basic types

Michele Caini 4 anos atrás
pai
commit
2e1529e78d
1 arquivos alterados com 21 adições e 17 exclusões
  1. 21 17
      src/entt/entity/entity.hpp

+ 21 - 17
src/entt/entity/entity.hpp

@@ -64,9 +64,9 @@ struct entt_traits<std::uint64_t> {
 
 
 /**
-* Internal details not to be documented.
-* @endcond
-*/
+ * Internal details not to be documented.
+ * @endcond
+ */
 
 
 /**
@@ -170,17 +170,19 @@ struct null_t {
 
     /**
      * @brief Compares two null objects.
+     * @param other A null object.
      * @return True in all cases.
      */
-    [[nodiscard]] constexpr bool operator==(const null_t &) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator==([[maybe_unused]] const null_t other) const ENTT_NOEXCEPT {
         return true;
     }
 
     /**
      * @brief Compares two null objects.
+     * @param other A null object.
      * @return False in all cases.
      */
-    [[nodiscard]] constexpr bool operator!=(const null_t &) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator!=([[maybe_unused]] const null_t other) const ENTT_NOEXCEPT {
         return false;
     }
 
@@ -191,7 +193,7 @@ struct null_t {
      * @return False if the two elements differ, true otherwise.
      */
     template<typename Entity>
-    [[nodiscard]] constexpr bool operator==(const Entity &entity) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator==(const Entity entity) const ENTT_NOEXCEPT {
         return entt_traits<Entity>::to_entity(entity) == entt_traits<Entity>::to_entity(*this);
     }
 
@@ -202,7 +204,7 @@ struct null_t {
      * @return True if the two elements differ, false otherwise.
      */
     template<typename Entity>
-    [[nodiscard]] constexpr bool operator!=(const Entity &entity) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator!=(const Entity entity) const ENTT_NOEXCEPT {
         return !(entity == *this);
     }
 
@@ -213,7 +215,7 @@ struct null_t {
      * @return The null representation for the given identifier.
      */
     template<typename Entity>
-    [[nodiscard]] constexpr Entity operator|(const Entity &entity) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr Entity operator|(const Entity entity) const ENTT_NOEXCEPT {
         return entt_traits<Entity>::to_type(*this, entity);
     }
 };
@@ -227,7 +229,7 @@ struct null_t {
  * @return False if the two elements differ, true otherwise.
  */
 template<typename Entity>
-[[nodiscard]] constexpr bool operator==(const Entity &entity, const null_t &other) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator==(const Entity entity, const null_t other) ENTT_NOEXCEPT {
     return other.operator==(entity);
 }
 
@@ -240,7 +242,7 @@ template<typename Entity>
  * @return True if the two elements differ, false otherwise.
  */
 template<typename Entity>
-[[nodiscard]] constexpr bool operator!=(const Entity &entity, const null_t &other) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator!=(const Entity entity, const null_t other) ENTT_NOEXCEPT {
     return !(other == entity);
 }
 
@@ -259,17 +261,19 @@ struct tombstone_t {
 
     /**
      * @brief Compares two tombstone objects.
+     * @param other A tombstone object.
      * @return True in all cases.
      */
-    [[nodiscard]] constexpr bool operator==(const tombstone_t &) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator==([[maybe_unused]] const tombstone_t other) const ENTT_NOEXCEPT {
         return true;
     }
 
     /**
      * @brief Compares two tombstone objects.
+     * @param other A tombstone object.
      * @return False in all cases.
      */
-    [[nodiscard]] constexpr bool operator!=(const tombstone_t &) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator!=([[maybe_unused]] const tombstone_t other) const ENTT_NOEXCEPT {
         return false;
     }
 
@@ -280,7 +284,7 @@ struct tombstone_t {
      * @return False if the two elements differ, true otherwise.
      */
     template<typename Entity>
-    [[nodiscard]] constexpr bool operator==(const Entity &entity) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator==(const Entity entity) const ENTT_NOEXCEPT {
         return entt_traits<Entity>::to_version(entity) == entt_traits<Entity>::to_version(*this);
     }
 
@@ -291,7 +295,7 @@ struct tombstone_t {
      * @return True if the two elements differ, false otherwise.
      */
     template<typename Entity>
-    [[nodiscard]] constexpr bool operator!=(const Entity &entity) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr bool operator!=(const Entity entity) const ENTT_NOEXCEPT {
         return !(entity == *this);
     }
 
@@ -302,7 +306,7 @@ struct tombstone_t {
      * @return The tombstone representation for the given identifier.
      */
     template<typename Entity>
-    [[nodiscard]] constexpr Entity operator|(const Entity &entity) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr Entity operator|(const Entity entity) const ENTT_NOEXCEPT {
         return entt_traits<Entity>::to_type(entity, *this);
     }
 };
@@ -316,7 +320,7 @@ struct tombstone_t {
  * @return False if the two elements differ, true otherwise.
  */
 template<typename Entity>
-[[nodiscard]] constexpr bool operator==(const Entity &entity, const tombstone_t &other) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator==(const Entity entity, const tombstone_t other) ENTT_NOEXCEPT {
     return other.operator==(entity);
 }
 
@@ -329,7 +333,7 @@ template<typename Entity>
  * @return True if the two elements differ, false otherwise.
  */
 template<typename Entity>
-[[nodiscard]] constexpr bool operator!=(const Entity &entity, const tombstone_t &other) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator!=(const Entity entity, const tombstone_t other) ENTT_NOEXCEPT {
     return !(other == entity);
 }