class AtomicLinkedList {
public:
AtomicLinkedList() {}
+ AtomicLinkedList(const AtomicLinkedList&) = delete;
+ AtomicLinkedList& operator=(const AtomicLinkedList&) = delete;
+ AtomicLinkedList(AtomicLinkedList&& other) noexcept {
+ auto tmp = other.head_.load();
+ other.head_ = head_.load();
+ head_ = tmp;
+ }
+ AtomicLinkedList& operator=(AtomicLinkedList&& other) noexcept {
+ auto tmp = other.head_.load();
+ other.head_ = head_.load();
+ head_ = tmp;
+
+ return *this;
+ }
/**
* Note: list must be empty on destruction.
*/
~AtomicLinkedList() {
- assert(head_ == nullptr);
+ assert(empty());
}
bool empty() const {