Sfoglia il codice sorgente

container: noexcept-ness review

Michele Caini 1 anno fa
parent
commit
24eed3da7a

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

@@ -12,10 +12,10 @@
 #include <utility>
 #include <utility>
 #include <vector>
 #include <vector>
 #include "../config/config.h"
 #include "../config/config.h"
+#include "../core/bit.hpp"
 #include "../core/compressed_pair.hpp"
 #include "../core/compressed_pair.hpp"
 #include "../core/iterator.hpp"
 #include "../core/iterator.hpp"
 #include "../core/memory.hpp"
 #include "../core/memory.hpp"
-#include "../core/bit.hpp"
 #include "../core/type_traits.hpp"
 #include "../core/type_traits.hpp"
 #include "fwd.hpp"
 #include "fwd.hpp"
 
 
@@ -424,7 +424,7 @@ public:
           threshold{other.threshold} {}
           threshold{other.threshold} {}
 
 
     /*! @brief Default move constructor. */
     /*! @brief Default move constructor. */
-    dense_map(dense_map &&) noexcept(std::is_nothrow_move_constructible_v<compressed_pair<sparse_container_type, hasher>> && std::is_nothrow_move_constructible_v<compressed_pair<packed_container_type, key_equal>>) = default;
+    dense_map(dense_map &&) noexcept = default;
 
 
     /**
     /**
      * @brief Allocator-extended move constructor.
      * @brief Allocator-extended move constructor.
@@ -449,7 +449,7 @@ public:
      * @brief Default move assignment operator.
      * @brief Default move assignment operator.
      * @return This container.
      * @return This container.
      */
      */
-    dense_map &operator=(dense_map &&) noexcept(std::is_nothrow_move_assignable_v<compressed_pair<sparse_container_type, hasher>> && std::is_nothrow_move_assignable_v<compressed_pair<packed_container_type, key_equal>>) = default;
+    dense_map &operator=(dense_map &&) noexcept = default;
 
 
     /**
     /**
      * @brief Returns the associated allocator.
      * @brief Returns the associated allocator.
@@ -697,7 +697,7 @@ public:
      * @brief Exchanges the contents with those of a given container.
      * @brief Exchanges the contents with those of a given container.
      * @param other Container to exchange the content with.
      * @param other Container to exchange the content with.
      */
      */
-    void swap(dense_map &other) {
+    void swap(dense_map &other) noexcept {
         using std::swap;
         using std::swap;
         swap(sparse, other.sparse);
         swap(sparse, other.sparse);
         swap(packed, other.packed);
         swap(packed, other.packed);

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

@@ -370,7 +370,7 @@ public:
           threshold{other.threshold} {}
           threshold{other.threshold} {}
 
 
     /*! @brief Default move constructor. */
     /*! @brief Default move constructor. */
-    dense_set(dense_set &&) noexcept(std::is_nothrow_move_constructible_v<compressed_pair<sparse_container_type, hasher>> && std::is_nothrow_move_constructible_v<compressed_pair<packed_container_type, key_equal>>) = default;
+    dense_set(dense_set &&) noexcept = default;
 
 
     /**
     /**
      * @brief Allocator-extended move constructor.
      * @brief Allocator-extended move constructor.
@@ -395,7 +395,7 @@ public:
      * @brief Default move assignment operator.
      * @brief Default move assignment operator.
      * @return This container.
      * @return This container.
      */
      */
-    dense_set &operator=(dense_set &&) noexcept(std::is_nothrow_move_assignable_v<compressed_pair<sparse_container_type, hasher>> && std::is_nothrow_move_assignable_v<compressed_pair<packed_container_type, key_equal>>) = default;
+    dense_set &operator=(dense_set &&) noexcept = default;
 
 
     /**
     /**
      * @brief Returns the associated allocator.
      * @brief Returns the associated allocator.
@@ -627,7 +627,7 @@ public:
      * @brief Exchanges the contents with those of a given container.
      * @brief Exchanges the contents with those of a given container.
      * @param other Container to exchange the content with.
      * @param other Container to exchange the content with.
      */
      */
-    void swap(dense_set &other) {
+    void swap(dense_set &other) noexcept {
         using std::swap;
         using std::swap;
         swap(sparse, other.sparse);
         swap(sparse, other.sparse);
         swap(packed, other.packed);
         swap(packed, other.packed);

+ 1 - 1
src/entt/container/table.hpp

@@ -260,7 +260,7 @@ public:
      * @brief Exchanges the contents with those of a given table.
      * @brief Exchanges the contents with those of a given table.
      * @param other Table to exchange the content with.
      * @param other Table to exchange the content with.
      */
      */
-    void swap(basic_table &other) {
+    void swap(basic_table &other) noexcept {
         using std::swap;
         using std::swap;
         swap(payload, other.payload);
         swap(payload, other.payload);
     }
     }