From fcc02c6bedb0c81e28a3c9c0efc22b7204e87276 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 3 Sep 2021 15:11:50 +0300 Subject: [PATCH] range_tombstone(_list): Mark some bits noexcept The range_tombstone's .empty() and .operator bool are trivially such. The swap()'s noexceptness comes from what it calls -- the without-link move constructor (noexcept) and .move_assign(). The latter is noexcept because it's already called from noexcept move-assign operator and because it calls noexcept move operators of tombstones' fields. The update_node() is noexcept for the same reason. The range_tombstone_list's clear() is noexcept because both -- set clear and disposer lambda are both such. Signed-off-by: Pavel Emelyanov --- range_tombstone.hh | 10 +++++----- range_tombstone_list.hh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/range_tombstone.hh b/range_tombstone.hh index b1a77ae506..1eff10da32 100644 --- a/range_tombstone.hh +++ b/range_tombstone.hh @@ -97,10 +97,10 @@ public: // Range tombstone covers all rows with positions p such that: position() <= p < end_position() position_in_partition_view position() const; position_in_partition_view end_position() const; - bool empty() const { + bool empty() const noexcept { return !bool(tomb); } - explicit operator bool() const { + explicit operator bool() const noexcept { return bool(tomb); } bool equal(const schema& s, const range_tombstone& other) const { @@ -113,7 +113,7 @@ public: return _c(rt1.start_bound(), rt2.start_bound()); } }; - friend void swap(range_tombstone& rt1, range_tombstone& rt2) { + friend void swap(range_tombstone& rt1, range_tombstone& rt2) noexcept { range_tombstone tmp(std::move(rt2), without_link()); rt2.move_assign(std::move(rt1)); rt1.move_assign(std::move(tmp)); @@ -215,14 +215,14 @@ public: return sizeof(range_tombstone) + minimal_external_memory_usage(s); } private: - void move_assign(range_tombstone&& rt) { + void move_assign(range_tombstone&& rt) noexcept { start = std::move(rt.start); start_kind = rt.start_kind; end = std::move(rt.end); end_kind = rt.end_kind; tomb = std::move(rt.tomb); } - void update_node(bi::set_member_hook>& other_link) { + void update_node(bi::set_member_hook>& other_link) noexcept { if (other_link.is_linked()) { // Move the link in case we're being relocated by LSA. container_type::node_algorithms::replace_node(other_link.this_ptr(), _link.this_ptr()); diff --git a/range_tombstone_list.hh b/range_tombstone_list.hh index 24ec35e9e3..638c148de1 100644 --- a/range_tombstone_list.hh +++ b/range_tombstone_list.hh @@ -198,7 +198,7 @@ public: } } } - void clear() { + void clear() noexcept { _tombstones.clear_and_dispose(current_deleter()); }