mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-16 22:16:58 +07:00
add lookup interface
This commit is contained in:
@@ -27,6 +27,11 @@ namespace
|
||||
(void)n;
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
constexpr std::add_const_t<T>& my_as_const(T& t) noexcept {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("flat_set") {
|
||||
@@ -125,4 +130,17 @@ TEST_CASE("flat_set") {
|
||||
s0.swap(s1);
|
||||
swap(s0, s1);
|
||||
}
|
||||
SECTION("lookup") {
|
||||
using set_t = flat_set<int>;
|
||||
set_t s0;
|
||||
s0.count(10);
|
||||
s0.find(10);
|
||||
my_as_const(s0).find(10);
|
||||
s0.equal_range(20);
|
||||
my_as_const(s0).equal_range(20);
|
||||
s0.lower_bound(30);
|
||||
my_as_const(s0).lower_bound(30);
|
||||
s0.upper_bound(30);
|
||||
my_as_const(s0).upper_bound(30);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user