aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorbugaevskiy <bugaevskiy@yandex-team.com>2022-07-23 21:28:06 +0300
committerbugaevskiy <bugaevskiy@yandex-team.com>2022-07-23 21:28:06 +0300
commitbdfa64a2dfbfa18015103f731c6017fd61a34842 (patch)
tree17f15b4a5bb4ca6546d19950902d0304175cf1db /library/cpp
parent4fdcbb93872d8192072780d5b346e91d229fa951 (diff)
downloadydb-bdfa64a2dfbfa18015103f731c6017fd61a34842.tar.gz
Reimport boost/align as a separate project
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/small_containers/compact_set-inl.h6
-rw-r--r--library/cpp/yt/small_containers/compact_set.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/library/cpp/yt/small_containers/compact_set-inl.h b/library/cpp/yt/small_containers/compact_set-inl.h
index 75b86001759..c027f446004 100644
--- a/library/cpp/yt/small_containers/compact_set-inl.h
+++ b/library/cpp/yt/small_containers/compact_set-inl.h
@@ -230,6 +230,12 @@ typename TCompactSet<T, N, C>::size_type TCompactSet<T, N, C>::count(const T& v)
}
template <typename T, unsigned N, typename C>
+bool TCompactSet<T, N, C>::contains(const T& v) const
+{
+ return count(v) == 1;
+}
+
+template <typename T, unsigned N, typename C>
std::pair<typename TCompactSet<T, N, C>::const_iterator, bool> TCompactSet<T, N, C>::insert(const T& v)
{
if (!IsSmall()) {
diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h
index 2ca8713ea72..910eef88eb0 100644
--- a/library/cpp/yt/small_containers/compact_set.h
+++ b/library/cpp/yt/small_containers/compact_set.h
@@ -46,6 +46,7 @@ private:
public:
class const_iterator;
using size_type = std::size_t;
+ using key_type = T;
TCompactSet() {}
@@ -58,6 +59,9 @@ public:
/// count - Return true if the element is in the set.
size_type count(const T& v) const;
+ /// contains - Return true if the element is in the set.
+ bool contains(const T& v) const;
+
/// insert - Insert an element into the set if it isn't already there.
std::pair<const_iterator, bool> insert(const T& v);