AK: Make DisjointChunk::append move the new chunk

Previously, although we were taking a moved chunk, we still copied it
into our chunk list. This makes DisjointChunk compatible with containers
that don't have a copy constructor but a move constructor.
This commit is contained in:
kleines Filmröllchen 2022-02-18 14:58:43 +01:00 committed by Ali Mohammad Pur
parent 6e5bf7ac6f
commit ee9eef1fa8

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -195,7 +196,7 @@ public:
DisjointChunks& operator=(DisjointChunks&&) = default;
DisjointChunks& operator=(DisjointChunks const&) = default;
void append(ChunkType&& chunk) { m_chunks.append(chunk); }
void append(ChunkType&& chunk) { m_chunks.append(move(chunk)); }
void extend(DisjointChunks&& chunks) { m_chunks.extend(move(chunks.m_chunks)); }
void extend(DisjointChunks const& chunks) { m_chunks.extend(chunks.m_chunks); }