dense_set: add max_size
This commit is contained in:
@@ -469,6 +469,14 @@ public:
|
||||
return packed.first().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the maximum possible number of elements.
|
||||
* @return Maximum possible number of elements.
|
||||
*/
|
||||
[[nodiscard]] size_type max_size() const noexcept {
|
||||
return packed.first().max_size();
|
||||
}
|
||||
|
||||
/*! @brief Clears the container. */
|
||||
void clear() noexcept {
|
||||
sparse.first().clear();
|
||||
|
||||
@@ -32,6 +32,7 @@ TEST(DenseSet, Functionalities) {
|
||||
ASSERT_EQ(set.size(), 0u);
|
||||
ASSERT_EQ(set.load_factor(), 0.f);
|
||||
ASSERT_EQ(set.max_load_factor(), .875f);
|
||||
ASSERT_EQ(set.max_size(), (std::vector<std::pair<std::size_t, std::size_t>>{}.max_size()));
|
||||
|
||||
set.max_load_factor(.9f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user