Browse Source

signal: noexcept-ness review

Michele Caini 1 year ago
parent
commit
a92be68bf7
3 changed files with 11 additions and 11 deletions
  1. 1 1
      src/entt/signal/dispatcher.hpp
  2. 1 1
      src/entt/signal/emitter.hpp
  3. 9 9
      src/entt/signal/sigh.hpp

+ 1 - 1
src/entt/signal/dispatcher.hpp

@@ -202,7 +202,7 @@ public:
      * @brief Exchanges the contents with those of a given dispatcher.
      * @param other Dispatcher to exchange the content with.
      */
-    void swap(basic_dispatcher &other) {
+    void swap(basic_dispatcher &other) noexcept {
         using std::swap;
         swap(pools, other.pools);
     }

+ 1 - 1
src/entt/signal/emitter.hpp

@@ -104,7 +104,7 @@ public:
      * @brief Exchanges the contents with those of a given emitter.
      * @param other Emitter to exchange the content with.
      */
-    void swap(emitter &other) {
+    void swap(emitter &other) noexcept {
         using std::swap;
         swap(handlers, other.handlers);
     }

+ 9 - 9
src/entt/signal/sigh.hpp

@@ -67,21 +67,21 @@ public:
     using sink_type = sink<sigh<Ret(Args...), Allocator>>;
 
     /*! @brief Default constructor. */
-    sigh() noexcept(std::is_nothrow_default_constructible_v<allocator_type> && std::is_nothrow_constructible_v<container_type, const allocator_type &>)
+    sigh() noexcept(noexcept(allocator_type{}))
         : sigh{allocator_type{}} {}
 
     /**
      * @brief Constructs a signal handler with a given allocator.
      * @param allocator The allocator to use.
      */
-    explicit sigh(const allocator_type &allocator) noexcept(std::is_nothrow_constructible_v<container_type, const allocator_type &>)
+    explicit sigh(const allocator_type &allocator) noexcept
         : calls{allocator} {}
 
     /**
      * @brief Copy constructor.
      * @param other The instance to copy from.
      */
-    sigh(const sigh &other) noexcept(std::is_nothrow_copy_constructible_v<container_type>)
+    sigh(const sigh &other)
         : calls{other.calls} {}
 
     /**
@@ -89,14 +89,14 @@ public:
      * @param other The instance to copy from.
      * @param allocator The allocator to use.
      */
-    sigh(const sigh &other, const allocator_type &allocator) noexcept(std::is_nothrow_constructible_v<container_type, const container_type &, const allocator_type &>)
+    sigh(const sigh &other, const allocator_type &allocator)
         : calls{other.calls, allocator} {}
 
     /**
      * @brief Move constructor.
      * @param other The instance to move from.
      */
-    sigh(sigh &&other) noexcept(std::is_nothrow_move_constructible_v<container_type>)
+    sigh(sigh &&other) noexcept
         : calls{std::move(other.calls)} {}
 
     /**
@@ -104,7 +104,7 @@ public:
      * @param other The instance to move from.
      * @param allocator The allocator to use.
      */
-    sigh(sigh &&other, const allocator_type &allocator) noexcept(std::is_nothrow_constructible_v<container_type, container_type &&, const allocator_type &>)
+    sigh(sigh &&other, const allocator_type &allocator)
         : calls{std::move(other.calls), allocator} {}
 
     /*! @brief Default destructor. */
@@ -115,7 +115,7 @@ public:
      * @param other The instance to copy from.
      * @return This signal handler.
      */
-    sigh &operator=(const sigh &other) noexcept(std::is_nothrow_copy_assignable_v<container_type>) {
+    sigh &operator=(const sigh &other) {
         calls = other.calls;
         return *this;
     }
@@ -125,7 +125,7 @@ public:
      * @param other The instance to move from.
      * @return This signal handler.
      */
-    sigh &operator=(sigh &&other) noexcept(std::is_nothrow_swappable_v<container_type>) {
+    sigh &operator=(sigh &&other) noexcept {
         swap(other);
         return *this;
     }
@@ -134,7 +134,7 @@ public:
      * @brief Exchanges the contents with those of a given signal handler.
      * @param other Signal handler to exchange the content with.
      */
-    void swap(sigh &other) noexcept(std::is_nothrow_swappable_v<container_type>) {
+    void swap(sigh &other) noexcept {
         using std::swap;
         swap(calls, other.calls);
     }