diff options
author | shakurov <shakurov@yandex-team.ru> | 2022-02-10 16:49:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:23 +0300 |
commit | 6750fac04a33847862ab7bfb19145f6f91207be6 (patch) | |
tree | 4ef07665d11f55d011c0cc9ea4b74d03390a5bdb /library/cpp/yt/small_containers/compact_set.h | |
parent | eb4b8b8ee0d18f168ae14f4d88a6efe2498e0f78 (diff) | |
download | ydb-6750fac04a33847862ab7bfb19145f6f91207be6.tar.gz |
Restoring authorship annotation for <shakurov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt/small_containers/compact_set.h')
-rw-r--r-- | library/cpp/yt/small_containers/compact_set.h | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h index 2ca8713ea7..f937114cd5 100644 --- a/library/cpp/yt/small_containers/compact_set.h +++ b/library/cpp/yt/small_containers/compact_set.h @@ -17,10 +17,10 @@ #include <util/system/yassert.h> -#include <cstddef> -#include <iterator> +#include <cstddef> +#include <iterator> #include <set> -#include <type_traits> +#include <type_traits> namespace NYT { @@ -29,58 +29,58 @@ namespace NYT { /// maintained with no mallocs. If the set gets large, we expand to using an /// std::set to maintain reasonable lookup times. /// -/// Note that any modification of the set may invalidate *all* iterators. -template <typename T, unsigned N, typename C = std::less<T>> +/// Note that any modification of the set may invalidate *all* iterators. +template <typename T, unsigned N, typename C = std::less<T>> class TCompactSet { -private: +private: /// Use a CompactVector to hold the elements here (even though it will never - /// reach its 'large' stage) to avoid calling the default ctors of elements - /// we will never use. + /// reach its 'large' stage) to avoid calling the default ctors of elements + /// we will never use. TCompactVector<T, N> Vector; - std::set<T, C> Set; - - using TSetConstIterator = typename std::set<T, C>::const_iterator; + std::set<T, C> Set; + + using TSetConstIterator = typename std::set<T, C>::const_iterator; using TVectorConstIterator = typename TCompactVector<T, N>::const_iterator; - + public: - class const_iterator; - using size_type = std::size_t; + class const_iterator; + using size_type = std::size_t; TCompactSet() {} - [[nodiscard]] bool empty() const; - - size_type size() const; + [[nodiscard]] bool empty() const; - const T& front() const; + size_type size() const; - /// count - Return true if the element is in the set. - size_type count(const T& v) const; + const T& front() const; - /// insert - Insert an element into the set if it isn't already there. - std::pair<const_iterator, bool> insert(const T& v); + /// count - Return true if the element is in the set. + size_type count(const T& v) const; - template <typename TIter> - void insert(TIter i, TIter e); + /// insert - Insert an element into the set if it isn't already there. + std::pair<const_iterator, bool> insert(const T& v); - bool erase(const T& v); + template <typename TIter> + void insert(TIter i, TIter e); - void clear(); - - const_iterator begin() const; - const_iterator cbegin() const; - - const_iterator end() const; - const_iterator cend() const; + bool erase(const T& v); + void clear(); + + const_iterator begin() const; + const_iterator cbegin() const; + + const_iterator end() const; + const_iterator cend() const; + private: - bool IsSmall() const; + bool IsSmall() const; }; } // namespace NYT - + #define COMPACT_SET_INL_H_ #include "compact_set-inl.h" #undef COMPACT_SET_INL_H_ - + |