diff options
author | yuraaka <yuraaka@yandex-team.ru> | 2022-02-10 16:47:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:05 +0300 |
commit | 4230543261d7a38ef4dc14785ae0d45f2da43704 (patch) | |
tree | 7d5099e41a66d7501887488432100e3cfc69ea72 /library/cpp/containers | |
parent | 8cac63f90980b825f78cbd01f45b396297047c2c (diff) | |
download | ydb-4230543261d7a38ef4dc14785ae0d45f2da43704.tar.gz |
Restoring authorship annotation for <yuraaka@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers')
-rw-r--r-- | library/cpp/containers/flat_hash/flat_hash.h | 42 | ||||
-rw-r--r-- | library/cpp/containers/flat_hash/lib/containers.h | 60 | ||||
-rw-r--r-- | library/cpp/containers/flat_hash/lib/map.h | 6 | ||||
-rw-r--r-- | library/cpp/containers/flat_hash/lib/set.h | 6 | ||||
-rw-r--r-- | library/cpp/containers/flat_hash/lib/table.h | 6 | ||||
-rw-r--r-- | library/cpp/containers/flat_hash/ut/flat_hash_ut.cpp | 60 |
6 files changed, 90 insertions, 90 deletions
diff --git a/library/cpp/containers/flat_hash/flat_hash.h b/library/cpp/containers/flat_hash/flat_hash.h index 582b8ae8f5d..b938c94c8ac 100644 --- a/library/cpp/containers/flat_hash/flat_hash.h +++ b/library/cpp/containers/flat_hash/flat_hash.h @@ -11,31 +11,31 @@ namespace NPrivate { -template <class Key, class T, class Hash, class KeyEqual, class Probing, class Alloc> +template <class Key, class T, class Hash, class KeyEqual, class Probing, class Alloc> using TFlatHashMapImpl = NFlatHash::TMap<Key, T, Hash, KeyEqual, - NFlatHash::TFlatContainer<std::pair<const Key, T>, Alloc>, + NFlatHash::TFlatContainer<std::pair<const Key, T>, Alloc>, Probing, NFlatHash::TAndSizeFitter, NFlatHash::TSimpleExpander>; -template <class Key, class T, auto emptyMarker, class Hash, class KeyEqual, class Probing, class Alloc> +template <class Key, class T, auto emptyMarker, class Hash, class KeyEqual, class Probing, class Alloc> using TDenseHashMapImpl = NFlatHash::TMap<Key, T, Hash, KeyEqual, NFlatHash::TDenseContainer<std::pair<const Key, T>, - NFlatHash::NMap::TStaticValueMarker<emptyMarker, T>, - Alloc>, + NFlatHash::NMap::TStaticValueMarker<emptyMarker, T>, + Alloc>, Probing, NFlatHash::TAndSizeFitter, NFlatHash::TSimpleExpander>; -template <class T, class Hash, class KeyEqual, class Probing, class Alloc> +template <class T, class Hash, class KeyEqual, class Probing, class Alloc> using TFlatHashSetImpl = NFlatHash::TSet<T, Hash, KeyEqual, - NFlatHash::TFlatContainer<T, Alloc>, + NFlatHash::TFlatContainer<T, Alloc>, Probing, NFlatHash::TAndSizeFitter, NFlatHash::TSimpleExpander>; -template <class T, auto emptyMarker, class Hash, class KeyEqual, class Probing, class Alloc> +template <class T, auto emptyMarker, class Hash, class KeyEqual, class Probing, class Alloc> using TDenseHashSetImpl = NFlatHash::TSet<T, Hash, KeyEqual, - NFlatHash::TDenseContainer<T, NFlatHash::NSet::TStaticValueMarker<emptyMarker>, Alloc>, + NFlatHash::TDenseContainer<T, NFlatHash::NSet::TStaticValueMarker<emptyMarker>, Alloc>, Probing, NFlatHash::TAndSizeFitter, NFlatHash::TSimpleExpander>; } // namespace NPrivate @@ -60,9 +60,9 @@ template <class Key, class T, class Hash = THash<Key>, class KeyEqual = std::equal_to<>, - class Probing = NFlatHash::TLinearProbing, - class Alloc = std::allocator<std::pair<const Key, T>>> -using TFlatHashMap = NPrivate::TFlatHashMapImpl<Key, T, Hash, KeyEqual, Probing, Alloc>; + class Probing = NFlatHash::TLinearProbing, + class Alloc = std::allocator<std::pair<const Key, T>>> +using TFlatHashMap = NPrivate::TFlatHashMapImpl<Key, T, Hash, KeyEqual, Probing, Alloc>; /* Open addressing table with user specified marker for empty buckets. * Currently available probings: @@ -75,10 +75,10 @@ template <class Key, auto emptyMarker, class Hash = THash<Key>, class KeyEqual = std::equal_to<>, - class Probing = NFlatHash::TDenseProbing, - class Alloc = std::allocator<std::pair<const Key, T>>> + class Probing = NFlatHash::TDenseProbing, + class Alloc = std::allocator<std::pair<const Key, T>>> using TDenseHashMapStaticMarker = NPrivate::TDenseHashMapImpl<Key, T, emptyMarker, - Hash, KeyEqual, Probing, Alloc>; + Hash, KeyEqual, Probing, Alloc>; /* flat_set: Fast and highly customizable hash set. @@ -98,9 +98,9 @@ using TDenseHashMapStaticMarker = NPrivate::TDenseHashMapImpl<Key, T, emptyMarke template <class T, class Hash = THash<T>, class KeyEqual = std::equal_to<>, - class Probing = NFlatHash::TLinearProbing, - class Alloc = std::allocator<T>> -using TFlatHashSet = NPrivate::TFlatHashSetImpl<T, Hash, KeyEqual, Probing, Alloc>; + class Probing = NFlatHash::TLinearProbing, + class Alloc = std::allocator<T>> +using TFlatHashSet = NPrivate::TFlatHashSetImpl<T, Hash, KeyEqual, Probing, Alloc>; /* Open addressing table with user specified marker for empty buckets. * Currently available probings: @@ -112,9 +112,9 @@ template <class T, auto emptyMarker, class Hash = THash<T>, class KeyEqual = std::equal_to<>, - class Probing = NFlatHash::TDenseProbing, - class Alloc = std::allocator<T>> + class Probing = NFlatHash::TDenseProbing, + class Alloc = std::allocator<T>> using TDenseHashSetStaticMarker = NPrivate::TDenseHashSetImpl<T, emptyMarker, - Hash, KeyEqual, Probing, Alloc>; + Hash, KeyEqual, Probing, Alloc>; } // namespace NFH diff --git a/library/cpp/containers/flat_hash/lib/containers.h b/library/cpp/containers/flat_hash/lib/containers.h index 82008f2f9cf..485eb7ae4f3 100644 --- a/library/cpp/containers/flat_hash/lib/containers.h +++ b/library/cpp/containers/flat_hash/lib/containers.h @@ -15,15 +15,15 @@ namespace NFlatHash { /* FLAT CONTAINER */ -template <class T, class Alloc = std::allocator<T>> +template <class T, class Alloc = std::allocator<T>> class TFlatContainer { public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; - using allocator_type = Alloc; - using pointer = typename std::allocator_traits<allocator_type>::pointer; - using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer; + using allocator_type = Alloc; + using pointer = typename std::allocator_traits<allocator_type>::pointer; + using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer; private: class TCage { @@ -98,8 +98,8 @@ private: }; public: - explicit TFlatContainer(size_type initSize, const allocator_type& alloc = {}) - : Buckets_(initSize, alloc) + explicit TFlatContainer(size_type initSize, const allocator_type& alloc = {}) + : Buckets_(initSize, alloc) , Taken_(0) , Empty_(initSize) {} @@ -145,10 +145,10 @@ public: DoSwap(Empty_, rhs.Empty_); } - TFlatContainer Clone(size_type newSize) const { return TFlatContainer(newSize, Buckets_.get_allocator()); } + TFlatContainer Clone(size_type newSize) const { return TFlatContainer(newSize, Buckets_.get_allocator()); } private: - TVector<TCage, allocator_type> Buckets_; + TVector<TCage, allocator_type> Buckets_; size_type Taken_; size_type Empty_; }; @@ -158,7 +158,7 @@ static_assert(NConcepts::RemovalContainerV<TFlatContainer<int>>); /* DENSE CONTAINER */ -template <class T, class EmptyMarker = NSet::TEqValueMarker<T>, class Alloc = std::allocator<T>> +template <class T, class EmptyMarker = NSet::TEqValueMarker<T>, class Alloc = std::allocator<T>> class TDenseContainer { static_assert(NConcepts::ValueMarkerV<EmptyMarker>); @@ -166,13 +166,13 @@ public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; - using allocator_type = Alloc; - using pointer = typename std::allocator_traits<allocator_type>::pointer; - using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer; + using allocator_type = Alloc; + using pointer = typename std::allocator_traits<allocator_type>::pointer; + using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer; public: - TDenseContainer(size_type initSize, EmptyMarker emptyMarker = {}, const allocator_type& alloc = {}) - : Buckets_(initSize, emptyMarker.Create(), alloc) + TDenseContainer(size_type initSize, EmptyMarker emptyMarker = {}, const allocator_type& alloc = {}) + : Buckets_(initSize, emptyMarker.Create(), alloc) , Taken_(0) , EmptyMarker_(std::move(emptyMarker)) {} @@ -217,15 +217,15 @@ public: DoSwap(Taken_, rhs.Taken_); } - TDenseContainer Clone(size_type newSize) const { return { newSize, EmptyMarker_, GetAllocator() }; } + TDenseContainer Clone(size_type newSize) const { return { newSize, EmptyMarker_, GetAllocator() }; } protected: - allocator_type GetAllocator() const { - return Buckets_.get_allocator(); - } - -protected: - TVector<value_type, allocator_type> Buckets_; + allocator_type GetAllocator() const { + return Buckets_.get_allocator(); + } + +protected: + TVector<value_type, allocator_type> Buckets_; size_type Taken_; EmptyMarker EmptyMarker_; }; @@ -234,8 +234,8 @@ static_assert(NConcepts::ContainerV<TDenseContainer<int>>); static_assert(!NConcepts::RemovalContainerV<TDenseContainer<int>>); template <class T, class DeletedMarker = NSet::TEqValueMarker<T>, - class EmptyMarker = NSet::TEqValueMarker<T>, class Alloc = std::allocator<T>> -class TRemovalDenseContainer : private TDenseContainer<T, EmptyMarker, Alloc> { + class EmptyMarker = NSet::TEqValueMarker<T>, class Alloc = std::allocator<T>> +class TRemovalDenseContainer : private TDenseContainer<T, EmptyMarker, Alloc> { private: static_assert(NConcepts::ValueMarkerV<DeletedMarker>); @@ -245,17 +245,17 @@ public: using typename TBase::value_type; using typename TBase::size_type; using typename TBase::difference_type; - using typename TBase::allocator_type; - using typename TBase::pointer; - using typename TBase::const_pointer; + using typename TBase::allocator_type; + using typename TBase::pointer; + using typename TBase::const_pointer; public: TRemovalDenseContainer( size_type initSize, DeletedMarker deletedMarker = {}, - EmptyMarker emptyMarker = {}, - const allocator_type& alloc = {}) - : TBase(initSize, std::move(emptyMarker), alloc) + EmptyMarker emptyMarker = {}, + const allocator_type& alloc = {}) + : TBase(initSize, std::move(emptyMarker), alloc) , DeletedMarker_(std::move(deletedMarker)) , Empty_(initSize) {} @@ -300,7 +300,7 @@ public: } TRemovalDenseContainer Clone(size_type newSize) const { - return { newSize, DeletedMarker_, TBase::EmptyMarker_, TBase::GetAllocator() }; + return { newSize, DeletedMarker_, TBase::EmptyMarker_, TBase::GetAllocator() }; } private: diff --git a/library/cpp/containers/flat_hash/lib/map.h b/library/cpp/containers/flat_hash/lib/map.h index f77c318a615..14ce5f8c9b7 100644 --- a/library/cpp/containers/flat_hash/lib/map.h +++ b/library/cpp/containers/flat_hash/lib/map.h @@ -67,9 +67,9 @@ public: using typename TBase::const_reference; using typename TBase::iterator; using typename TBase::const_iterator; - using typename TBase::allocator_type; - using typename TBase::pointer; - using typename TBase::const_pointer; + using typename TBase::allocator_type; + using typename TBase::pointer; + using typename TBase::const_pointer; private: static constexpr size_type INIT_SIZE = 8; diff --git a/library/cpp/containers/flat_hash/lib/set.h b/library/cpp/containers/flat_hash/lib/set.h index 5266293c6c3..2694711a35a 100644 --- a/library/cpp/containers/flat_hash/lib/set.h +++ b/library/cpp/containers/flat_hash/lib/set.h @@ -58,9 +58,9 @@ public: using typename TBase::const_reference; using typename TBase::iterator; using typename TBase::const_iterator; - using typename TBase::allocator_type; - using typename TBase::pointer; - using typename TBase::const_pointer; + using typename TBase::allocator_type; + using typename TBase::pointer; + using typename TBase::const_pointer; private: static constexpr size_type INIT_SIZE = 8; diff --git a/library/cpp/containers/flat_hash/lib/table.h b/library/cpp/containers/flat_hash/lib/table.h index b84a052be75..2af81056a87 100644 --- a/library/cpp/containers/flat_hash/lib/table.h +++ b/library/cpp/containers/flat_hash/lib/table.h @@ -57,9 +57,9 @@ public: using iterator = TIteratorImpl<typename IteratorModifier<Container>::type, typename IteratorModifier<value_type>::type>; using const_iterator = TIteratorImpl<const Container, const value_type>; - using allocator_type = typename Container::allocator_type; - using pointer = typename Container::pointer; - using const_pointer = typename Container::const_pointer; + using allocator_type = typename Container::allocator_type; + using pointer = typename Container::pointer; + using const_pointer = typename Container::const_pointer; private: TTable(Container buckets) diff --git a/library/cpp/containers/flat_hash/ut/flat_hash_ut.cpp b/library/cpp/containers/flat_hash/ut/flat_hash_ut.cpp index 2b9d6a1dc2a..76004649c07 100644 --- a/library/cpp/containers/flat_hash/ut/flat_hash_ut.cpp +++ b/library/cpp/containers/flat_hash/ut/flat_hash_ut.cpp @@ -20,8 +20,8 @@ const std::initializer_list<std::pair<const int, TString>> MAP_INPUT_SAMPLE{ template <class Map> class TMapTest : public TTestBase { - void AllocatorTest(); - + void AllocatorTest(); + void SmokingTest() { Map mp; mp.emplace(5, "abc"); @@ -123,7 +123,7 @@ class TMapTest : public TTestBase { } UNIT_TEST_SUITE_DEMANGLE(TMapTest); - UNIT_TEST(AllocatorTest); + UNIT_TEST(AllocatorTest); UNIT_TEST(SmokingTest); UNIT_TEST(CopyConstructionTest); UNIT_TEST(MoveConstructionTest); @@ -135,18 +135,18 @@ class TMapTest : public TTestBase { UNIT_TEST_SUITE_END(); }; -template <> -void TMapTest<TFlatHashMap<int, TString>>::AllocatorTest() { - using Map = TFlatHashMap<int, TString>; - Map mp(3, typename Map::allocator_type()); -} - -template <> -void TMapTest<TDenseHashMapStaticMarker<int, TString, -1>>::AllocatorTest() { - using Map = TDenseHashMapStaticMarker<int, TString, -1>; - Map mp(3, NFlatHash::NMap::TStaticValueMarker<-1, TString>(), typename Map::allocator_type()); -} - +template <> +void TMapTest<TFlatHashMap<int, TString>>::AllocatorTest() { + using Map = TFlatHashMap<int, TString>; + Map mp(3, typename Map::allocator_type()); +} + +template <> +void TMapTest<TDenseHashMapStaticMarker<int, TString, -1>>::AllocatorTest() { + using Map = TDenseHashMapStaticMarker<int, TString, -1>; + Map mp(3, NFlatHash::NMap::TStaticValueMarker<-1, TString>(), typename Map::allocator_type()); +} + using TFlatHashMapTest = TMapTest<TFlatHashMap<int, TString>>; using TDenseHashMapTest = TMapTest<TDenseHashMapStaticMarker<int, TString, -1>>; @@ -156,7 +156,7 @@ UNIT_TEST_SUITE_REGISTRATION(TDenseHashMapTest); template <class Set> class TSetTest : public TTestBase { - void AllocatorTest(); + void AllocatorTest(); void DefaultConstructTest() { Set st; @@ -241,7 +241,7 @@ class TSetTest : public TTestBase { } UNIT_TEST_SUITE_DEMANGLE(TSetTest); - UNIT_TEST(AllocatorTest); + UNIT_TEST(AllocatorTest); UNIT_TEST(DefaultConstructTest); UNIT_TEST(InitCapacityConstructTest); UNIT_TEST(IteratorsConstructTest); @@ -253,19 +253,19 @@ class TSetTest : public TTestBase { UNIT_TEST_SUITE_END(); }; -template <> -void TSetTest<TFlatHashSet<int>>::AllocatorTest() { - using Map = TFlatHashSet<int>; - Map mp(3, typename Map::allocator_type()); -} - -template <> -void TSetTest<TDenseHashSetStaticMarker<int, -1>>::AllocatorTest() { - using Map = TDenseHashSetStaticMarker<int, -1>; - Map mp(3, NFlatHash::NSet::TStaticValueMarker<-1>(), typename Map::allocator_type()); -} - -using TFlatHashSetTest = TSetTest<TFlatHashSet<int, THash<int>>>; +template <> +void TSetTest<TFlatHashSet<int>>::AllocatorTest() { + using Map = TFlatHashSet<int>; + Map mp(3, typename Map::allocator_type()); +} + +template <> +void TSetTest<TDenseHashSetStaticMarker<int, -1>>::AllocatorTest() { + using Map = TDenseHashSetStaticMarker<int, -1>; + Map mp(3, NFlatHash::NSet::TStaticValueMarker<-1>(), typename Map::allocator_type()); +} + +using TFlatHashSetTest = TSetTest<TFlatHashSet<int, THash<int>>>; using TDenseHashSetTest = TSetTest<TDenseHashSetStaticMarker<int, -1>>; UNIT_TEST_SUITE_REGISTRATION(TFlatHashSetTest); |