From 3a89d7f6ea2679ff7b9bb1e3c37da9480be6c115 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Fri, 12 Jan 2024 11:29:37 -0500 Subject: BufferView.h: Hopefully the last necessary tweak to the move semantics stuff You can't move assign an std::Bind, but you can move construct it. So I had to disable the move assignment operator. This means that when you change the BufferView ownership over to, say, a QueryBufferState object, you need to do it by passing std::move(buffview) into a constructor call only--you cannot assign it. --- include/framework/structure/BufferView.h | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/framework/structure/BufferView.h b/include/framework/structure/BufferView.h index d058714..47c7b9b 100644 --- a/include/framework/structure/BufferView.h +++ b/include/framework/structure/BufferView.h @@ -20,23 +20,10 @@ namespace de { typedef std::_Bind ReleaseFunction; -static void noop_func(void *arg1, size_t arg2) { - return; -} - -constexpr auto noop_bind = std::bind(noop_func, (void*) nullptr, 0ul); - template class BufferView { public: - BufferView() - : m_data(nullptr) - , m_release(noop_bind) - , m_head(0) - , m_tail(0) - , m_cap(0) - , m_approx_ts_cnt(0) - , m_tombstone_filter(nullptr) {} + BufferView() = default; /* * the BufferView's lifetime is tightly linked to buffer versioning, and so @@ -54,17 +41,8 @@ public: , m_approx_ts_cnt(std::exchange(other.m_approx_ts_cnt, 0)) , m_tombstone_filter(std::exchange(other.m_tombstone_filter, nullptr)) {} - BufferView &operator=(BufferView &&other) noexcept { - std::swap(m_data, other.m_data); - m_release = std::move(other.m_release); - std::swap(m_head, other.m_head); - std::swap(m_tail, other.m_tail); - std::swap(m_cap, other.m_cap); - std::swap(m_approx_ts_cnt, other.m_approx_ts_cnt); - std::swap(m_tombstone_filter, other.m_tombstone_filter); + BufferView &operator=(BufferView &&other) = delete; - return *this; - } BufferView(Wrapped *buffer, size_t cap, size_t head, size_t tail, size_t tombstone_cnt, psudb::BloomFilter *filter, ReleaseFunction release) -- cgit v1.2.3