From 8e890135fe082b6bb4cd761a745327a06eb77d99 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 6 May 2022 12:25:07 +0200 Subject: [PATCH] compressed pair: make the full class conditionally noexcept --- src/entt/core/compressed_pair.hpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/entt/core/compressed_pair.hpp b/src/entt/core/compressed_pair.hpp index d5c16a0ff..49713888a 100644 --- a/src/entt/core/compressed_pair.hpp +++ b/src/entt/core/compressed_pair.hpp @@ -25,9 +25,9 @@ struct compressed_pair_element { constexpr compressed_pair_element() noexcept(std::is_nothrow_default_constructible_v) : value{} {} - template>, compressed_pair_element>>> - constexpr compressed_pair_element(Args &&args) noexcept(std::is_nothrow_constructible_v) - : value{std::forward(args)} {} + template>, compressed_pair_element>>> + constexpr compressed_pair_element(Arg &&arg) noexcept(std::is_nothrow_constructible_v) + : value{std::forward(arg)} {} template constexpr compressed_pair_element(std::tuple args, std::index_sequence) noexcept(std::is_nothrow_constructible_v) @@ -55,9 +55,9 @@ struct compressed_pair_element) : base_type{} {} - template>, compressed_pair_element>>> - constexpr compressed_pair_element(Args &&args) noexcept(std::is_nothrow_constructible_v) - : base_type{std::forward(args)} {} + template>, compressed_pair_element>>> + constexpr compressed_pair_element(Arg &&arg) noexcept(std::is_nothrow_constructible_v) + : base_type{std::forward(arg)} {} template constexpr compressed_pair_element(std::tuple args, std::index_sequence) noexcept(std::is_nothrow_constructible_v) @@ -110,7 +110,7 @@ public: * @tparam Dummy Dummy template parameter used for internal purposes. */ template && std::is_default_constructible_v>> - constexpr compressed_pair() + constexpr compressed_pair() noexcept(std::is_nothrow_default_constructible_v &&std::is_nothrow_default_constructible_v) : first_base{}, second_base{} {} @@ -118,13 +118,13 @@ public: * @brief Copy constructor. * @param other The instance to copy from. */ - constexpr compressed_pair(const compressed_pair &other) = default; + constexpr compressed_pair(const compressed_pair &other) noexcept(std::is_nothrow_copy_constructible_v &&std::is_nothrow_copy_constructible_v) = default; /** * @brief Move constructor. * @param other The instance to move from. */ - constexpr compressed_pair(compressed_pair &&other) = default; + constexpr compressed_pair(compressed_pair &&other) noexcept(std::is_nothrow_move_constructible_v &&std::is_nothrow_move_constructible_v) = default; /** * @brief Constructs a pair from its values. @@ -134,7 +134,7 @@ public: * @param other Value to use to initialize the second element. */ template - constexpr compressed_pair(Arg &&arg, Other &&other) + constexpr compressed_pair(Arg &&arg, Other &&other) noexcept(std::is_nothrow_constructible_v &&std::is_nothrow_constructible_v) : first_base{std::forward(arg)}, second_base{std::forward(other)} {} @@ -146,7 +146,7 @@ public: * @param other Arguments to use to initialize the second element. */ template - constexpr compressed_pair(std::piecewise_construct_t, std::tuple args, std::tuple other) + constexpr compressed_pair(std::piecewise_construct_t, std::tuple args, std::tuple other) noexcept(std::is_nothrow_constructible_v &&std::is_nothrow_constructible_v) : first_base{std::move(args), std::index_sequence_for{}}, second_base{std::move(other), std::index_sequence_for{}} {} @@ -155,14 +155,14 @@ public: * @param other The instance to copy from. * @return This compressed pair object. */ - constexpr compressed_pair &operator=(const compressed_pair &other) = default; + constexpr compressed_pair &operator=(const compressed_pair &other) noexcept(std::is_nothrow_copy_assignable_v &&std::is_nothrow_copy_assignable_v) = default; /** * @brief Move assignment operator. * @param other The instance to move from. * @return This compressed pair object. */ - constexpr compressed_pair &operator=(compressed_pair &&other) = default; + constexpr compressed_pair &operator=(compressed_pair &&other) noexcept(std::is_nothrow_move_assignable_v &&std::is_nothrow_move_assignable_v) = default; /** * @brief Returns the first element that a pair stores. @@ -194,7 +194,7 @@ public: * @brief Swaps two compressed pair objects. * @param other The compressed pair to swap with. */ - constexpr void swap(compressed_pair &other) { + constexpr void swap(compressed_pair &other) noexcept(std::is_nothrow_swappable_v &&std::is_nothrow_swappable_v) { using std::swap; swap(first(), other.first()); swap(second(), other.second());