add lookup interface

This commit is contained in:
2019-05-04 12:21:16 +07:00
parent beb5d0a2c8
commit b29067b6ed
4 changed files with 126 additions and 0 deletions

View File

@@ -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);
}
}