diff --git a/include/utils/spsc_queue.h b/include/utils/spsc_queue.h index 8d76072..dcaeecc 100644 --- a/include/utils/spsc_queue.h +++ b/include/utils/spsc_queue.h @@ -184,6 +184,19 @@ private: struct Cell { std::atomic seq; T data; + + Cell() : seq(0), data() {} + Cell(const Cell&) = delete; + Cell& operator=(const Cell&) = delete; + Cell(Cell&& other) noexcept + : seq(other.seq.load(std::memory_order_relaxed)), data(std::move(other.data)) {} + Cell& operator=(Cell&& other) noexcept { + if (this != &other) { + seq.store(other.seq.load(std::memory_order_relaxed), std::memory_order_relaxed); + data = std::move(other.data); + } + return *this; + } }; // Lock-free bounded MPMC queue (Vyukov). We still expose it as SPSC in this project,