mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
AK: Introduce ability to default-initialize a Variant
I noticed that Variant<Empty, …> is a somewhat common pattern while working on #10080, and this will simplify a few use-cases. :^)
This commit is contained in:
parent
f261b68408
commit
743470c8f2
2 changed files with 12 additions and 1 deletions
|
@ -219,3 +219,10 @@ TEST_CASE(copy_assign)
|
|||
EXPECT_EQ(the_value.get<String>(), "Hello, world!");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(default_empty)
|
||||
{
|
||||
Variant<Empty, int> my_variant;
|
||||
EXPECT(my_variant.has<Empty>());
|
||||
EXPECT(!my_variant.has<int>());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue