Ver Fonte

review: return values

Michele Caini há 7 anos atrás
pai
commit
b921e7d595
2 ficheiros alterados com 9 adições e 9 exclusões
  1. 3 3
      src/entt/entity/sparse_set.hpp
  2. 6 6
      src/entt/entity/view.hpp

+ 3 - 3
src/entt/entity/sparse_set.hpp

@@ -367,11 +367,11 @@ public:
     }
 
     /**
-     * @brief Returns a reference to the element at the given position.
+     * @brief Returns the identifier that occupies the given position.
      * @param pos Position of the element to return.
-     * @return A reference to the requested element.
+     * @return The identifier that occupies the given position.
      */
-    inline const entity_type & operator[](const size_type pos) const ENTT_NOEXCEPT {
+    inline entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
         return cbegin()[pos];
     }
 

+ 6 - 6
src/entt/entity/view.hpp

@@ -249,11 +249,11 @@ public:
     }
 
     /**
-     * @brief Returns a reference to the element at the given position.
+     * @brief Returns the identifier that occupies the given position.
      * @param pos Position of the element to return.
-     * @return A reference to the requested element.
+     * @return The identifier that occupies the given position.
      */
-    const entity_type & operator[](const size_type pos) const ENTT_NOEXCEPT {
+    entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
         return (*view)[pos];
     }
 
@@ -1101,11 +1101,11 @@ public:
     }
 
     /**
-     * @brief Returns a reference to the element at the given position.
+     * @brief Returns the identifier that occupies the given position.
      * @param pos Position of the element to return.
-     * @return A reference to the requested element.
+     * @return The identifier that occupies the given position.
      */
-    const entity_type & operator[](const size_type pos) const ENTT_NOEXCEPT {
+    entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
         return pool->view_type::operator[](pos);
     }