Skip to content

Commit

Permalink
core: noexcept-ness review
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Sep 17, 2024
1 parent a92be68 commit a5ce90b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/entt/core/compressed_pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ class compressed_pair final
* @brief Copy constructor.
* @param other The instance to copy from.
*/
constexpr compressed_pair(const compressed_pair &other) noexcept(std::is_nothrow_copy_constructible_v<first_base> && std::is_nothrow_copy_constructible_v<second_base>) = default;
constexpr compressed_pair(const compressed_pair &other) = default;

/**
* @brief Move constructor.
* @param other The instance to move from.
*/
constexpr compressed_pair(compressed_pair &&other) noexcept(std::is_nothrow_move_constructible_v<first_base> && std::is_nothrow_move_constructible_v<second_base>) = default;
constexpr compressed_pair(compressed_pair &&other) noexcept = default;

/**
* @brief Constructs a pair from its values.
Expand Down Expand Up @@ -151,14 +151,14 @@ class compressed_pair final
* @param other The instance to copy from.
* @return This compressed pair object.
*/
constexpr compressed_pair &operator=(const compressed_pair &other) noexcept(std::is_nothrow_copy_assignable_v<first_base> && std::is_nothrow_copy_assignable_v<second_base>) = default;
constexpr compressed_pair &operator=(const compressed_pair &other) = default;

/**
* @brief Move assignment operator.
* @param other The instance to move from.
* @return This compressed pair object.
*/
constexpr compressed_pair &operator=(compressed_pair &&other) noexcept(std::is_nothrow_move_assignable_v<first_base> && std::is_nothrow_move_assignable_v<second_base>) = default;
constexpr compressed_pair &operator=(compressed_pair &&other) noexcept = default;

/**
* @brief Returns the first element that a pair stores.
Expand Down Expand Up @@ -190,7 +190,7 @@ class compressed_pair final
* @brief Swaps two compressed pair objects.
* @param other The compressed pair to swap with.
*/
constexpr void swap(compressed_pair &other) noexcept(std::is_nothrow_swappable_v<first_type> && std::is_nothrow_swappable_v<second_type>) {
constexpr void swap(compressed_pair &other) noexcept {
using std::swap;
swap(first(), other.first());
swap(second(), other.second());
Expand Down
4 changes: 2 additions & 2 deletions src/entt/core/iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ struct iterable_adaptor final {
using sentinel = Sentinel;

/*! @brief Default constructor. */
constexpr iterable_adaptor() noexcept(std::is_nothrow_default_constructible_v<iterator> &&std::is_nothrow_default_constructible_v<sentinel>)
constexpr iterable_adaptor() noexcept(std::is_nothrow_default_constructible_v<iterator> && std::is_nothrow_default_constructible_v<sentinel>)
: first{},
last{} {}

Expand All @@ -156,7 +156,7 @@ struct iterable_adaptor final {
* @param from Begin iterator.
* @param to End iterator.
*/
constexpr iterable_adaptor(iterator from, sentinel to) noexcept(std::is_nothrow_move_constructible_v<iterator> &&std::is_nothrow_move_constructible_v<sentinel>)
constexpr iterable_adaptor(iterator from, sentinel to) noexcept(std::is_nothrow_move_constructible_v<iterator> && std::is_nothrow_move_constructible_v<sentinel>)
: first{std::move(from)},
last{std::move(to)} {}

Expand Down

0 comments on commit a5ce90b

Please sign in to comment.