BLI: add Set.clear method
This commit is contained in:
@@ -284,6 +284,12 @@ class Set {
|
|||||||
return this->size() == 0;
|
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.
|
* Returns true when there is at least one element that is in both sets.
|
||||||
* Otherwise false.
|
* Otherwise false.
|
||||||
|
@@ -194,3 +194,11 @@ TEST(set, UniquePtrValues)
|
|||||||
|
|
||||||
EXPECT_EQ(set.size(), 3);
|
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);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user