mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-13 01:36:27 +07:00
heterogeneous find, lower_bound and upper_bound
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <flat.hpp/flat_multimap.hpp>
|
||||
using namespace flat_hpp;
|
||||
|
||||
@@ -54,6 +57,10 @@ namespace
|
||||
}
|
||||
|
||||
TEST_CASE("flat_multimap") {
|
||||
SECTION("detail") {
|
||||
STATIC_REQUIRE(detail::is_transparent<std::less<>, int>::value);
|
||||
STATIC_REQUIRE_FALSE(detail::is_transparent<std::less<int>, int>::value);
|
||||
}
|
||||
SECTION("sizeof") {
|
||||
REQUIRE(sizeof(flat_multimap<int, unsigned>) == sizeof(std::vector<std::pair<int, unsigned>>));
|
||||
|
||||
@@ -405,6 +412,13 @@ TEST_CASE("flat_multimap") {
|
||||
REQUIRE(my_as_const(s0).lower_bound(-1) == s0.cbegin());
|
||||
REQUIRE(my_as_const(s0).lower_bound(7) == s0.cbegin() + 4);
|
||||
}
|
||||
{
|
||||
flat_multimap<std::string, int, std::less<>> s0{{"hello", 42}, {"world", 84}};
|
||||
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("observers") {
|
||||
struct my_less {
|
||||
|
||||
Reference in New Issue
Block a user