dense_set: adjust noexcept policy

This commit is contained in:
Michele Caini
2022-02-15 10:26:42 +01:00
parent 3f1dee2650
commit 0fbddfc47b

View File

@@ -53,17 +53,17 @@ struct dense_set_node final: Allocator {
std::allocator_traits<allocator_type>::construct(*this, reinterpret_cast<Type *>(&instance), other.element());
}
dense_set_node(dense_set_node &&other) ENTT_NOEXCEPT
dense_set_node(dense_set_node &&other)
: dense_set_node{std::allocator_arg, Allocator{}, std::move(other)} {
}
dense_set_node(std::allocator_arg_t, const allocator_type &allocator, dense_set_node &&other) ENTT_NOEXCEPT
dense_set_node(std::allocator_arg_t, const allocator_type &allocator, dense_set_node &&other)
: Allocator{allocator},
next{other.next} {
std::allocator_traits<allocator_type>::construct(*this, reinterpret_cast<Type *>(&instance), std::move(other.element()));
}
~dense_set_node() ENTT_NOEXCEPT {
~dense_set_node() {
std::destroy_at(reinterpret_cast<const Type *>(&instance));
}
@@ -98,7 +98,7 @@ public:
: it{iter} {}
template<bool Const = std::is_const_v<std::remove_pointer_t<It>>, typename = std::enable_if_t<Const>>
dense_set_iterator(const dense_set_iterator<std::remove_const_t<std::remove_pointer_t<It>> *> &other)
dense_set_iterator(const dense_set_iterator<std::remove_const_t<std::remove_pointer_t<It>> *> &other) ENTT_NOEXCEPT
: it{other.it} {}
dense_set_iterator &operator++() ENTT_NOEXCEPT {
@@ -137,15 +137,15 @@ public:
return (*this + -value);
}
[[nodiscard]] reference operator[](const difference_type value) const {
[[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
return it[value].element();
}
[[nodiscard]] pointer operator->() const {
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
return std::addressof(it->element());
}
[[nodiscard]] reference operator*() const {
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
return *operator->();
}
@@ -217,7 +217,7 @@ public:
offset{pos} {}
template<bool Const = std::is_const_v<std::remove_pointer_t<It>>, typename = std::enable_if_t<Const>>
dense_set_local_iterator(const dense_set_local_iterator<std::remove_const_t<std::remove_pointer_t<It>> *> &other)
dense_set_local_iterator(const dense_set_local_iterator<std::remove_const_t<std::remove_pointer_t<It>> *> &other) ENTT_NOEXCEPT
: it{other.it},
offset{other.offset} {}
@@ -230,11 +230,11 @@ public:
return ++(*this), orig;
}
[[nodiscard]] pointer operator->() const {
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
return std::addressof(it[offset].element());
}
[[nodiscard]] reference operator*() const {
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
return *operator->();
}
@@ -432,14 +432,14 @@ public:
* @brief Default move constructor.
* @param other The instance to move from.
*/
dense_set(dense_set &&other) ENTT_NOEXCEPT = default;
dense_set(dense_set &&other) = default;
/**
* @brief Allocator-extended move constructor.
* @param other The instance to move from.
* @param allocator The allocator to use.
*/
dense_set(dense_set &&other, const allocator_type &allocator) ENTT_NOEXCEPT
dense_set(dense_set &&other, const allocator_type &allocator)
: sparse{sparse_container_type{std::move(other.sparse.first()), allocator}, std::move(other.sparse.second())},
// cannot move the container directly due to a nasty issue of apple clang :(
packed{packed_container_type{std::make_move_iterator(other.packed.first().begin()), std::make_move_iterator(other.packed.first().end()), allocator}, std::move(other.packed.second())},
@@ -468,7 +468,7 @@ public:
* @param other The instance to move from.
* @return This container.
*/
dense_set &operator=(dense_set &&other) ENTT_NOEXCEPT = default;
dense_set &operator=(dense_set &&other) = default;
/**
* @brief Returns the associated allocator.