Ver código fonte

*: minor changes, coding style

Michele Caini 1 ano atrás
pai
commit
6777f8538b

+ 11 - 11
src/entt/container/dense_map.hpp

@@ -454,6 +454,17 @@ public:
      */
     dense_map &operator=(dense_map &&) noexcept = default;
 
+    /**
+     * @brief Exchanges the contents with those of a given container.
+     * @param other Container to exchange the content with.
+     */
+    void swap(dense_map &other) noexcept {
+        using std::swap;
+        swap(sparse, other.sparse);
+        swap(packed, other.packed);
+        swap(threshold, other.threshold);
+    }
+
     /**
      * @brief Returns the associated allocator.
      * @return The associated allocator.
@@ -696,17 +707,6 @@ public:
         return 0u;
     }
 
-    /**
-     * @brief Exchanges the contents with those of a given container.
-     * @param other Container to exchange the content with.
-     */
-    void swap(dense_map &other) noexcept {
-        using std::swap;
-        swap(sparse, other.sparse);
-        swap(packed, other.packed);
-        swap(threshold, other.threshold);
-    }
-
     /**
      * @brief Accesses a given element with bounds checking.
      * @param key A key of an element to find.

+ 11 - 11
src/entt/container/dense_set.hpp

@@ -399,6 +399,17 @@ public:
      */
     dense_set &operator=(dense_set &&) noexcept = default;
 
+    /**
+     * @brief Exchanges the contents with those of a given container.
+     * @param other Container to exchange the content with.
+     */
+    void swap(dense_set &other) noexcept {
+        using std::swap;
+        swap(sparse, other.sparse);
+        swap(packed, other.packed);
+        swap(threshold, other.threshold);
+    }
+
     /**
      * @brief Returns the associated allocator.
      * @return The associated allocator.
@@ -625,17 +636,6 @@ public:
         return 0u;
     }
 
-    /**
-     * @brief Exchanges the contents with those of a given container.
-     * @param other Container to exchange the content with.
-     */
-    void swap(dense_set &other) noexcept {
-        using std::swap;
-        swap(sparse, other.sparse);
-        swap(packed, other.packed);
-        swap(threshold, other.threshold);
-    }
-
     /**
      * @brief Returns the number of elements matching a value (either 1 or 0).
      * @param key Key value of an element to search for.

+ 10 - 10
src/entt/graph/adjacency_matrix.hpp

@@ -180,6 +180,16 @@ public:
      */
     adjacency_matrix &operator=(adjacency_matrix &&) noexcept = default;
 
+    /**
+     * @brief Exchanges the contents with those of a given adjacency matrix.
+     * @param other Adjacency matrix to exchange the content with.
+     */
+    void swap(adjacency_matrix &other) noexcept {
+        using std::swap;
+        swap(matrix, other.matrix);
+        swap(vert, other.vert);
+    }
+
     /**
      * @brief Returns the associated allocator.
      * @return The associated allocator.
@@ -194,16 +204,6 @@ public:
         vert = {};
     }
 
-    /**
-     * @brief Exchanges the contents with those of a given adjacency matrix.
-     * @param other Adjacency matrix to exchange the content with.
-     */
-    void swap(adjacency_matrix &other) noexcept {
-        using std::swap;
-        swap(matrix, other.matrix);
-        swap(vert, other.vert);
-    }
-
     /**
      * @brief Returns true if an adjacency matrix is empty, false otherwise.
      *

+ 12 - 12
src/entt/graph/flow.hpp

@@ -180,6 +180,18 @@ public:
      */
     basic_flow &operator=(basic_flow &&) noexcept = default;
 
+    /**
+     * @brief Exchanges the contents with those of a given flow builder.
+     * @param other Flow builder to exchange the content with.
+     */
+    void swap(basic_flow &other) noexcept {
+        using std::swap;
+        std::swap(index, other.index);
+        std::swap(vertices, other.vertices);
+        std::swap(deps, other.deps);
+        std::swap(sync_on, other.sync_on);
+    }
+
     /**
      * @brief Returns the associated allocator.
      * @return The associated allocator.
@@ -205,18 +217,6 @@ public:
         sync_on = {};
     }
 
-    /**
-     * @brief Exchanges the contents with those of a given flow builder.
-     * @param other Flow builder to exchange the content with.
-     */
-    void swap(basic_flow &other) noexcept {
-        using std::swap;
-        std::swap(index, other.index);
-        std::swap(vertices, other.vertices);
-        std::swap(deps, other.deps);
-        std::swap(sync_on, other.sync_on);
-    }
-
     /**
      * @brief Returns true if a flow builder contains no tasks, false otherwise.
      * @return True if the flow builder contains no tasks, false otherwise.