mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-13 17:48:14 +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_multiset.hpp>
|
||||
using namespace flat_hpp;
|
||||
|
||||
@@ -54,6 +57,10 @@ namespace
|
||||
}
|
||||
|
||||
TEST_CASE("flat_multiset") {
|
||||
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_multiset<int>) == sizeof(std::vector<int>));
|
||||
|
||||
@@ -381,6 +388,13 @@ TEST_CASE("flat_multiset") {
|
||||
REQUIRE(my_as_const(s0).lower_bound(-1) == s0.cbegin());
|
||||
REQUIRE(my_as_const(s0).lower_bound(7) == s0.cbegin() + 4);
|
||||
}
|
||||
{
|
||||
flat_multiset<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("observers") {
|
||||
struct my_less {
|
||||
|
||||
Reference in New Issue
Block a user