BLI: add Set.clear method
This commit is contained in:
parent
d575b72c16
commit
c05ef1459c
|
@ -284,6 +284,12 @@ class Set {
|
|||
return this->size() == 0;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->~Set();
|
||||
new (this) Set();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when there is at least one element that is in both sets.
|
||||
* Otherwise false.
|
||||
|
|
|
@ -194,3 +194,11 @@ TEST(set, UniquePtrValues)
|
|||
|
||||
EXPECT_EQ(set.size(), 3);
|
||||
}
|
||||
|
||||
TEST(set, Clear)
|
||||
{
|
||||
Set<int> set = {3, 4, 6, 7};
|
||||
EXPECT_EQ(set.size(), 4);
|
||||
set.clear();
|
||||
EXPECT_EQ(set.size(), 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue