mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
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.
This commit is contained in:
parent
44a6d7968a
commit
4758dac218
2 changed files with 12 additions and 2 deletions
|
@ -13,8 +13,11 @@
|
|||
TEST_CASE(basic)
|
||||
{
|
||||
DisjointChunks<size_t> chunks;
|
||||
EXPECT(chunks.is_empty());
|
||||
chunks.append({});
|
||||
EXPECT(chunks.is_empty());
|
||||
chunks.last_chunk().append(0);
|
||||
EXPECT(!chunks.is_empty());
|
||||
chunks.append({});
|
||||
chunks.last_chunk().append(1);
|
||||
chunks.last_chunk().append(2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue