diff --git a/AK/DisjointChunks.h b/AK/DisjointChunks.h index 688604a02f4..d07d3d8690f 100644 --- a/AK/DisjointChunks.h +++ b/AK/DisjointChunks.h @@ -15,11 +15,11 @@ namespace AK { -template +template struct DisjointIterator { struct EndTag { }; - using ReferenceType = Conditional>, Vector>&; + using ReferenceType = Conditional>, Vector>&; DisjointIterator(ReferenceType chunks) : m_chunks(chunks) @@ -232,6 +232,9 @@ FixedArray shatter_chunk(FixedArray& source_chunk, size_t start, size_t sl template> class DisjointChunks { +private: + constexpr static auto InlineCapacity = IsCopyConstructible ? 1 : 0; + public: DisjointChunks() = default; ~DisjointChunks() = default; @@ -397,10 +400,10 @@ public: m_chunks.remove(1, m_chunks.size() - 1); } - DisjointIterator begin() { return { m_chunks }; } - DisjointIterator end() { return { m_chunks, {} }; } - DisjointIterator begin() const { return { m_chunks }; } - DisjointIterator end() const { return { m_chunks, {} }; } + DisjointIterator begin() { return { m_chunks }; } + DisjointIterator end() { return { m_chunks, {} }; } + DisjointIterator begin() const { return { m_chunks }; } + DisjointIterator end() const { return { m_chunks, {} }; } private: struct ChunkAndOffset { @@ -428,7 +431,7 @@ private: return { &m_chunks.last(), index - (offset - m_chunks.last().size()) }; } - Vector m_chunks; + Vector m_chunks; }; }