Merge pull request #47672 from Matan-B/wip-matanb-buffer-next

include/buffer: clear_and_dispose() fix implicitly-declared operator= usage

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2022-08-23 23:24:15 +08:00 committed by GitHub
commit a1d8b793e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -594,13 +594,13 @@ struct error_code;
}
}
void clear_and_dispose() {
for (auto it = begin(); it != end(); /* nop */) {
auto& node = *it;
it = it->next;
ptr_node::disposer()(&node);
}
_root.next = &_root;
_tail = &_root;
ptr_node::disposer dispose;
for (auto it = begin(), e = end(); it != e; /* nop */) {
auto& node = *it++;
dispose(&node);
}
_tail = &_root;
_root.next = _tail;
}
iterator erase_after_and_dispose(iterator it) {
auto* to_dispose = &*std::next(it);