mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-13 17:48:14 +07:00
heterogeneous at, erase, count and equal_range
This commit is contained in:
@@ -386,13 +386,21 @@ TEST_CASE("flat_set") {
|
||||
REQUIRE(my_as_const(s0).lower_bound(-1) == s0.cbegin());
|
||||
REQUIRE(my_as_const(s0).lower_bound(7) == s0.cbegin() + 3);
|
||||
}
|
||||
{
|
||||
flat_set<std::string, std::less<>> s0{"hello", "world"};
|
||||
REQUIRE(s0.find(std::string_view("hello")) == s0.begin());
|
||||
REQUIRE(my_as_const(s0).find(std::string_view("world")) == s0.begin() + 1);
|
||||
REQUIRE(s0.find(std::string_view("42")) == s0.end());
|
||||
REQUIRE(my_as_const(s0).find(std::string_view("42")) == s0.cend());
|
||||
}
|
||||
}
|
||||
SECTION("heterogeneous") {
|
||||
flat_set<std::string, std::less<>> s0{"hello", "world"};
|
||||
REQUIRE(s0.find(std::string_view("hello")) == s0.begin());
|
||||
REQUIRE(my_as_const(s0).find(std::string_view("world")) == s0.begin() + 1);
|
||||
REQUIRE(s0.find(std::string_view("42")) == s0.end());
|
||||
REQUIRE(my_as_const(s0).find(std::string_view("42")) == s0.cend());
|
||||
|
||||
REQUIRE(my_as_const(s0).count(std::string_view("hello")) == 1);
|
||||
REQUIRE(my_as_const(s0).count(std::string_view("hello_42")) == 0);
|
||||
|
||||
REQUIRE(s0.upper_bound(std::string_view("hello")) == s0.begin() + 1);
|
||||
REQUIRE(my_as_const(s0).upper_bound(std::string_view("hello")) == s0.begin() + 1);
|
||||
|
||||
REQUIRE(s0.erase(std::string_view("hello")) == 1);
|
||||
}
|
||||
SECTION("observers") {
|
||||
struct my_less {
|
||||
|
||||
Reference in New Issue
Block a user