فهرست منبع

container/entity: noexcept-ness review

Michele Caini 3 سال پیش
والد
کامیت
acbd38c1ed
4فایلهای تغییر یافته به همراه6 افزوده شده و 7 حذف شده
  1. 0 1
      TODO
  2. 2 2
      src/entt/container/dense_map.hpp
  3. 2 2
      src/entt/container/dense_set.hpp
  4. 2 2
      src/entt/entity/registry.hpp

+ 0 - 1
TODO

@@ -14,7 +14,6 @@ DOC:
 WIP:
 * sparse set/storage support for move-only types, internal rework required
 * get rid of observers, storage based views made them pointless - document alternatives
-* dense_map/set and registry: move ctor/op should be noexcept (op is conditionally noexcept though)
 * add storage getter for filters to views and groups
 * exploit the tombstone mechanism to allow enabling/disabling entities (see bump, compact and clear for further details)
 * emitter: runtime handlers, allocator support (ready for both already)

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

@@ -429,7 +429,7 @@ public:
           threshold{other.threshold} {}
 
     /*! @brief Default move constructor. */
-    dense_map(dense_map &&) = default;
+    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;
 
     /**
      * @brief Allocator-extended move constructor.
@@ -451,7 +451,7 @@ public:
      * @brief Default move assignment operator.
      * @return This container.
      */
-    dense_map &operator=(dense_map &&) = default;
+    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;
 
     /**
      * @brief Returns the associated allocator.

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

@@ -375,7 +375,7 @@ public:
           threshold{other.threshold} {}
 
     /*! @brief Default move constructor. */
-    dense_set(dense_set &&) = default;
+    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;
 
     /**
      * @brief Allocator-extended move constructor.
@@ -397,7 +397,7 @@ public:
      * @brief Default move assignment operator.
      * @return This container.
      */
-    dense_set &operator=(dense_set &&) = default;
+    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;
 
     /**
      * @brief Returns the associated allocator.

+ 2 - 2
src/entt/entity/registry.hpp

@@ -351,7 +351,7 @@ public:
      * @brief Move constructor.
      * @param other The instance to move from.
      */
-    basic_registry(basic_registry &&other)
+    basic_registry(basic_registry &&other) noexcept
         : pools{std::move(other.pools)},
           groups{std::move(other.groups)},
           epool{std::move(other.epool)},
@@ -367,7 +367,7 @@ public:
      * @param other The instance to move from.
      * @return This registry.
      */
-    basic_registry &operator=(basic_registry &&other) {
+    basic_registry &operator=(basic_registry &&other) noexcept {
         pools = std::move(other.pools);
         groups = std::move(other.groups);
         epool = std::move(other.epool);