mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
cpp-btree: Add contains method to match STL
This commit is contained in:
parent
e060e9b83d
commit
44dffb0e81
6
src/3rdparty/cpp-btree/btree_container.h
vendored
6
src/3rdparty/cpp-btree/btree_container.h
vendored
@ -192,6 +192,9 @@ class btree_unique_container : public btree_container<Tree> {
|
||||
size_type count(const key_type &key) const {
|
||||
return this->tree_.count_unique(key);
|
||||
}
|
||||
bool contains(const key_type &key) const {
|
||||
return this->count(key) > 0;
|
||||
}
|
||||
|
||||
// Insertion routines.
|
||||
std::pair<iterator,bool> insert(const value_type &x) {
|
||||
@ -311,6 +314,9 @@ class btree_multi_container : public btree_container<Tree> {
|
||||
size_type count(const key_type &key) const {
|
||||
return this->tree_.count_multi(key);
|
||||
}
|
||||
bool contains(const key_type &key) const {
|
||||
return this->find(key) != this->end();
|
||||
}
|
||||
|
||||
// Insertion routines.
|
||||
iterator insert(const value_type &x) {
|
||||
|
Loading…
Reference in New Issue
Block a user