Commit graph

15 commits

Author SHA1 Message Date
Linus Groh 9c08bb9555 AK: Remove try_ prefix from FixedArray creation functions 2023-01-28 22:41:36 +01:00
Linus Groh d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Andreas Kling ae3ffdd521 AK: Make it possible to not using AK classes into the global namespace
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by
default, but can be overridden by build flags.

This is a step towards integrating Jakt and AK types.
2022-11-26 15:51:34 +01:00
Ali Mohammad Pur c2b20b5681 AK: Give DisjointChunks::m_chunks an inline capacity of 1
That's one fewer level of indirection for flattened ones.
2022-11-17 20:13:04 +03:30
Ali Mohammad Pur e9b9527440 AK: Add a fast path for DisjointChunks::spans() 2022-11-17 20:13:04 +03:30
Ali Mohammad Pur f59bd33876 AK: Allow DisjointChunks::spans to return a vector with inline capacity 2022-11-17 20:13:04 +03:30
kleines Filmröllchen 7e18e6e37b AK: Skip over initial empty chunks in DisjointChunks
This will be caught by new test cases: when the initial chunk is empty,
a dereference before calling operator++ on the iterator will crash as
the initial chunk's size is never checked.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen 4ec599aae5 AK: Make DisjointChunks support FixedArray
This extracts the shatter_chunk logic, because it needs to be different
for FixedArray.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen ee9eef1fa8 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.
2022-02-27 00:11:14 +03:30
kleines Filmröllchen 6e5bf7ac6f AK: Export DisjointSpans into the global namespace
I think we just forgot when we added it.
2022-02-27 00:11:14 +03:30
Michel Hermier 4758dac218 AK: Make Disjoint*::is_empty() not call size
This is a raffinement of 49cbd4dcca.

Previously, the container was scanned to compute the size in the unhappy
path. Now, using `all_of` happy and unhappy path should be fast.
2021-12-24 05:55:34 -08:00
Michel Hermier 3a177b9209 AK: Add DisjointChunkc::ensure_capacity 2021-12-24 05:55:34 -08:00
Ali Mohammad Pur 49cbd4dcca AK: Make DisjointChunks not query size() when there are no chunks 2021-12-21 22:10:07 +01:00
Ali Mohammad Pur 2df54a7b56 AK: Add Disjoint(Chunks Spans)::find(index)
For when the may or may not be out of bounds.
2021-12-21 22:10:07 +01:00
Ali Mohammad Pur ccb53c64e9 AK: Add an abstraction over multiple disjoint buffers
DisjointChunks<T> provides a nice interface over multiple sequential
Vector<T>'s, allowing the user to iterate over/index into/slice from
said buffers as if they were a single contiguous buffer.
To work with views on such objects, DisjointSpans<T> is provided, which
has the same behaviour but does not own the underlying objects.
2021-09-14 21:33:15 +04:30