mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-16 14:09:01 +07:00
add contains function #25
This commit is contained in:
@@ -508,6 +508,18 @@ namespace flat_hpp
|
||||
: end();
|
||||
}
|
||||
|
||||
bool contains(const key_type& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
template < typename K >
|
||||
std::enable_if_t<
|
||||
detail::is_transparent_v<Compare, K>,
|
||||
bool>
|
||||
contains(const K& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
std::pair<iterator, iterator> equal_range(const key_type& key) {
|
||||
const base_type& comp = *this;
|
||||
return std::equal_range(begin(), end(), key, comp);
|
||||
|
||||
@@ -458,6 +458,18 @@ namespace flat_hpp
|
||||
: end();
|
||||
}
|
||||
|
||||
bool contains(const key_type& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
template < typename K >
|
||||
std::enable_if_t<
|
||||
detail::is_transparent_v<Compare, K>,
|
||||
bool>
|
||||
contains(const K& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
std::pair<iterator, iterator> equal_range(const key_type& key) {
|
||||
const base_type& comp = *this;
|
||||
return std::equal_range(begin(), end(), key, comp);
|
||||
|
||||
@@ -386,6 +386,18 @@ namespace flat_hpp
|
||||
: end();
|
||||
}
|
||||
|
||||
bool contains(const key_type& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
template < typename K >
|
||||
std::enable_if_t<
|
||||
detail::is_transparent_v<Compare, K>,
|
||||
bool>
|
||||
contains(const K& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
std::pair<iterator, iterator> equal_range(const key_type& key) {
|
||||
return std::equal_range(begin(), end(), key, key_comp());
|
||||
}
|
||||
|
||||
@@ -436,6 +436,18 @@ namespace flat_hpp
|
||||
: end();
|
||||
}
|
||||
|
||||
bool contains(const key_type& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
template < typename K >
|
||||
std::enable_if_t<
|
||||
detail::is_transparent_v<Compare, K>,
|
||||
bool>
|
||||
contains(const K& key) const {
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
std::pair<iterator, iterator> equal_range(const key_type& key) {
|
||||
return std::equal_range(begin(), end(), key, key_comp());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user