diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2022-11-30 13:05:32 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2022-11-30 13:05:32 +0300 |
commit | 413dfef105af7cae29c970cbb3d0a5abaf24cc3c (patch) | |
tree | ab555e905942ea8a8d6df86a10ff488f1133550a | |
parent | 9ad09e7577f8a62bec5acd44e88fc4f00aec04e6 (diff) | |
download | ydb-413dfef105af7cae29c970cbb3d0a5abaf24cc3c.tar.gz |
Add C++20 compatible 'contains'.
-rw-r--r-- | library/cpp/containers/sorted_vector/sorted_vector.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/cpp/containers/sorted_vector/sorted_vector.h b/library/cpp/containers/sorted_vector/sorted_vector.h index 123539af9e..0369ba27c2 100644 --- a/library/cpp/containers/sorted_vector/sorted_vector.h +++ b/library/cpp/containers/sorted_vector/sorted_vector.h @@ -238,6 +238,11 @@ namespace NSorted { } template<class K> + Y_FORCE_INLINE bool contains(const K& key) const { + return this->Has(key); + } + + template<class K> Y_FORCE_INLINE iterator LowerBound(const K& key) { return ::LowerBound(TBase::begin(), TBase::end(), key, TKeyCompare()); } |