Commit b32206c4 authored by Jüri Valdmann's avatar Jüri Valdmann Committed by Commit Bot

Add missing definition of swap in base::IntrusiveHeap

Change-Id: I508786031d2658ab907661caea71fa6e45270006
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862686Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Jüri Valdmann <juri.valdmann@qt.io>
Cr-Commit-Position: refs/heads/master@{#707772}
parent 1b8c4fc8
......@@ -458,7 +458,7 @@ class IntrusiveHeap {
// General operations.
void swap(IntrusiveHeap& other) noexcept;
friend void swap(IntrusiveHeap& lhs, IntrusiveHeap& rhs);
friend void swap(IntrusiveHeap& lhs, IntrusiveHeap& rhs) { lhs.swap(rhs); }
// Comparison operators. These check for exact equality. Two heaps that are
// semantically equivalent (contain the same elements, but in different
......
......@@ -585,6 +585,17 @@ TEST(IntrusiveHeapTest, Assignment) {
ExpectCanonical(heap2);
}
TEST(IntrusiveHeapTest, Swap) {
IntrusiveHeapInt heap{CANONICAL_ELEMENTS};
IntrusiveHeapInt heap2;
swap(heap, heap2);
EXPECT_TRUE(heap.empty());
ExpectCanonical(heap2);
heap.swap(heap2);
EXPECT_TRUE(heap2.empty());
ExpectCanonical(heap);
}
TEST(IntrusiveHeapTest, ElementAccess) {
IntrusiveHeapInt heap{CANONICAL_ELEMENTS};
EXPECT_EQ(heap.front(), heap[0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment