diff options
author | mihaild <mihaild@yandex-team.ru> | 2022-02-10 16:46:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:59 +0300 |
commit | 246417ad6168d3f7ab4a0cf1c79ba4259f7c45ae (patch) | |
tree | 2a65611ade91c8ae2f55647107c1a11ea743abd5 /util/generic | |
parent | 5598c5e7bc7619bd51d87fea7b880b7788ad0b47 (diff) | |
download | ydb-246417ad6168d3f7ab4a0cf1c79ba4259f7c45ae.tar.gz |
Restoring authorship annotation for <mihaild@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r-- | util/generic/algorithm.h | 22 | ||||
-rw-r--r-- | util/generic/algorithm_ut.cpp | 4 | ||||
-rw-r--r-- | util/generic/deque.h | 4 | ||||
-rw-r--r-- | util/generic/hash.h | 26 | ||||
-rw-r--r-- | util/generic/hash_set.h | 20 | ||||
-rw-r--r-- | util/generic/hash_ut.cpp | 12 | ||||
-rw-r--r-- | util/generic/list.h | 2 | ||||
-rw-r--r-- | util/generic/map.h | 2 | ||||
-rw-r--r-- | util/generic/map_ut.cpp | 26 | ||||
-rw-r--r-- | util/generic/set_ut.cpp | 2 | ||||
-rw-r--r-- | util/generic/typetraits.h | 14 | ||||
-rw-r--r-- | util/generic/vector.h | 4 |
12 files changed, 69 insertions, 69 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb88993..d4c1c4ac6c 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -9,7 +9,7 @@ #include <numeric> #include <algorithm> #include <iterator> -#include <utility> +#include <utility> namespace NPrivate { template <class I, class F, class P> @@ -656,12 +656,12 @@ static inline auto CountIf(const C& c, P pred) { } template <class I1, class I2> -static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2) { +static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2) { return std::mismatch(b1, e1, b2); } template <class I1, class I2, class P> -static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, P p) { +static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, P p) { return std::mismatch(b1, e1, b2, p); } @@ -677,21 +677,21 @@ static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIt // no standard implementation until C++14 template <class I1, class I2> -static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2) { +static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2) { while (b1 != e1 && b2 != e2 && *b1 == *b2) { ++b1; ++b2; } - return std::make_pair(b1, b2); + return std::make_pair(b1, b2); } template <class I1, class I2, class P> -static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2, P p) { +static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2, P p) { while (b1 != e1 && b2 != e2 && p(*b1, *b2)) { ++b1; ++b2; } - return std::make_pair(b1, b2); + return std::make_pair(b1, b2); } template <class It, class Val> @@ -705,12 +705,12 @@ static inline bool BinarySearch(It begin, It end, const Val& val, Comp comp) { } template <class It, class Val> -static inline std::pair<It, It> EqualRange(It begin, It end, const Val& val) { +static inline std::pair<It, It> EqualRange(It begin, It end, const Val& val) { return std::equal_range(begin, end, val); } template <class It, class Val, class Comp> -static inline std::pair<It, It> EqualRange(It begin, It end, const Val& val, Comp comp) { +static inline std::pair<It, It> EqualRange(It begin, It end, const Val& val, Comp comp) { return std::equal_range(begin, end, val, comp); } @@ -745,12 +745,12 @@ TO CopyIf(TI begin, TI end, TO to, P pred) { } template <class T> -std::pair<const T&, const T&> MinMax(const T& first, const T& second) { +std::pair<const T&, const T&> MinMax(const T& first, const T& second) { return std::minmax(first, second); } template <class It> -std::pair<It, It> MinMaxElement(It first, It last) { +std::pair<It, It> MinMaxElement(It first, It last) { return std::minmax_element(first, last); } diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0c..d13cd6b0d9 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -391,7 +391,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { { int data[] = {1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 5}; - using PairOfInt = std::pair<int*, int*>; + using PairOfInt = std::pair<int*, int*>; PairOfInt tmp = EqualRange(data, data + Y_ARRAY_SIZE(data), 3); UNIT_ASSERT_EQUAL(tmp.second - tmp.first, 4); @@ -603,7 +603,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(MinMaxTest) { - std::pair<int, int> p1 = MinMax(5, 12); + std::pair<int, int> p1 = MinMax(5, 12); UNIT_ASSERT_EQUAL(p1.first, 5); UNIT_ASSERT_EQUAL(p1.second, 12); diff --git a/util/generic/deque.h b/util/generic/deque.h index 2dabaf3177..4440adb8f2 100644 --- a/util/generic/deque.h +++ b/util/generic/deque.h @@ -15,8 +15,8 @@ class TDeque: public std::deque<T, TReboundAllocator<A, T>> { public: using TBase::TBase; - inline yssize_t ysize() const noexcept { - return (yssize_t)this->size(); + inline yssize_t ysize() const noexcept { + return (yssize_t)this->size(); } inline explicit operator bool() const noexcept { diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa9..fc64dc2c29 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -15,7 +15,7 @@ #include <initializer_list> #include <memory> #include <tuple> -#include <utility> +#include <utility> #include <cstdlib> @@ -1027,13 +1027,13 @@ std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V if (first) /*y*/ for (node* cur = first; !((uintptr_t)cur & 1); cur = cur->next) /*y*/ if (equals(get_key(cur->val), get_key(obj))) - return std::pair<iterator, bool>(iterator(cur), false); /*y*/ + return std::pair<iterator, bool>(iterator(cur), false); /*y*/ node* tmp = new_node(obj); tmp->next = first ? first : (node*)((uintptr_t)&buckets[n + 1] | 1); /*y*/ buckets[n] = tmp; ++num_elements; - return std::pair<iterator, bool>(iterator(tmp), true); /*y*/ + return std::pair<iterator, bool>(iterator(tmp), true); /*y*/ } template <class V, class K, class HF, class Ex, class Eq, class A> @@ -1099,7 +1099,7 @@ __yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::find_i(const OtherKey& template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> std::pair<__yhashtable_iterator<V>, __yhashtable_iterator<V>> THashTable<V, K, HF, Ex, Eq, A>::equal_range(const OtherKey& key) { - using pii = std::pair<iterator, iterator>; + using pii = std::pair<iterator, iterator>; const size_type n = bkt_num_key(key); node* first = buckets[n]; @@ -1122,7 +1122,7 @@ std::pair<__yhashtable_iterator<V>, __yhashtable_iterator<V>> THashTable<V, K, H template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> std::pair<__yhashtable_const_iterator<V>, __yhashtable_const_iterator<V>> THashTable<V, K, HF, Ex, Eq, A>::equal_range(const OtherKey& key) const { - using pii = std::pair<const_iterator, const_iterator>; + using pii = std::pair<const_iterator, const_iterator>; const size_type n = bkt_num_key(key); const node* first = buckets[n]; @@ -1525,7 +1525,7 @@ public: return rep.size(); } yssize_t ysize() const noexcept { - return (yssize_t)rep.size(); + return (yssize_t)rep.size(); } size_type max_size() const noexcept { return rep.max_size(); @@ -1566,7 +1566,7 @@ public: rep.insert_unique(f, l); } - std::pair<iterator, bool> insert(const value_type& obj) { + std::pair<iterator, bool> insert(const value_type& obj) { return rep.insert_unique(obj); } @@ -1677,12 +1677,12 @@ public: } template <class TKey> - std::pair<iterator, iterator> equal_range(const TKey& key) { + std::pair<iterator, iterator> equal_range(const TKey& key) { return rep.equal_range(key); } template <class TKey> - std::pair<const_iterator, const_iterator> equal_range(const TKey& key) const { + std::pair<const_iterator, const_iterator> equal_range(const TKey& key) const { return rep.equal_range(key); } @@ -1849,8 +1849,8 @@ public: size_type size() const { return rep.size(); } - yssize_t ysize() const { - return (yssize_t)rep.size(); + yssize_t ysize() const { + return (yssize_t)rep.size(); } size_type max_size() const { return rep.max_size(); @@ -1945,12 +1945,12 @@ public: } template <class TKey> - std::pair<iterator, iterator> equal_range(const TKey& key) { + std::pair<iterator, iterator> equal_range(const TKey& key) { return rep.equal_range(key); } template <class TKey> - std::pair<const_iterator, const_iterator> equal_range(const TKey& key) const { + std::pair<const_iterator, const_iterator> equal_range(const TKey& key) const { return rep.equal_range(key); } diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h index e8088cf23b..ea91f3386d 100644 --- a/util/generic/hash_set.h +++ b/util/generic/hash_set.h @@ -4,7 +4,7 @@ #include "hash.h" #include <initializer_list> -#include <utility> +#include <utility> #undef value_type @@ -156,9 +156,9 @@ public: rep.insert_unique(f, l); } - std::pair<iterator, bool> insert(const value_type& obj) { - std::pair<mutable_iterator, bool> p = rep.insert_unique(obj); - return std::pair<iterator, bool>(p.first, p.second); + std::pair<iterator, bool> insert(const value_type& obj) { + std::pair<mutable_iterator, bool> p = rep.insert_unique(obj); + return std::pair<iterator, bool>(p.first, p.second); } template <typename... Args> std::pair<iterator, bool> emplace(Args&&... args) { @@ -167,13 +167,13 @@ public: } iterator insert(const_iterator, const value_type& obj) { // insert_hint - std::pair<mutable_iterator, bool> p = rep.insert_unique(obj); + std::pair<mutable_iterator, bool> p = rep.insert_unique(obj); return p.first; } - std::pair<iterator, bool> insert_noresize(const value_type& obj) { - std::pair<mutable_iterator, bool> p = rep.insert_unique_noresize(obj); - return std::pair<iterator, bool>(p.first, p.second); + std::pair<iterator, bool> insert_noresize(const value_type& obj) { + std::pair<mutable_iterator, bool> p = rep.insert_unique_noresize(obj); + return std::pair<iterator, bool>(p.first, p.second); } template <typename... Args> std::pair<iterator, bool> emplace_noresize(Args&&... args) { @@ -214,7 +214,7 @@ public: } template <class TKey> - std::pair<iterator, iterator> equal_range(const TKey& key) const { + std::pair<iterator, iterator> equal_range(const TKey& key) const { return rep.equal_range(key); } @@ -422,7 +422,7 @@ public: } template <class TKey> - std::pair<iterator, iterator> equal_range(const TKey& key) const { + std::pair<iterator, iterator> equal_range(const TKey& key) const { return rep.equal_range(key); } diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index 0551d58770..2a7eba2f49 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -295,13 +295,13 @@ void THashTest::TestHMMap1() { mmap m; UNIT_ASSERT(m.count('X') == 0); - m.insert(std::pair<const char, int>('X', 10)); // Standard way. + m.insert(std::pair<const char, int>('X', 10)); // Standard way. UNIT_ASSERT(m.count('X') == 1); - m.insert(std::pair<const char, int>('X', 20)); // jbuck: standard way + m.insert(std::pair<const char, int>('X', 20)); // jbuck: standard way UNIT_ASSERT(m.count('X') == 2); - m.insert(std::pair<const char, int>('Y', 32)); // jbuck: standard way + m.insert(std::pair<const char, int>('Y', 32)); // jbuck: standard way mmap::iterator i = m.find('X'); // Find first match. UNIT_ASSERT((*i).first == 'X'); @@ -358,9 +358,9 @@ void THashTest::TestHMMap1() { void THashTest::TestHMMapHas() { using mmap = THashMultiMap<char, int, THash<char>, TEqualTo<char>>; mmap m; - m.insert(std::pair<const char, int>('X', 10)); - m.insert(std::pair<const char, int>('X', 20)); - m.insert(std::pair<const char, int>('Y', 32)); + m.insert(std::pair<const char, int>('X', 10)); + m.insert(std::pair<const char, int>('X', 20)); + m.insert(std::pair<const char, int>('Y', 32)); UNIT_ASSERT(m.contains('X')); UNIT_ASSERT(m.contains('Y')); UNIT_ASSERT(!m.contains('Z')); diff --git a/util/generic/list.h b/util/generic/list.h index 7b0b8ffc72..8dac504e96 100644 --- a/util/generic/list.h +++ b/util/generic/list.h @@ -7,7 +7,7 @@ #include <initializer_list> #include <list> #include <memory> -#include <utility> +#include <utility> template <class T, class A> class TList: public std::list<T, TReboundAllocator<A, T>> { diff --git a/util/generic/map.h b/util/generic/map.h index b5001b56c0..39df17b785 100644 --- a/util/generic/map.h +++ b/util/generic/map.h @@ -6,7 +6,7 @@ #include <util/str_stl.h> #include <util/memory/alloc.h> -#include <utility> +#include <utility> #include <initializer_list> #include <map> #include <memory> diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index 79e832b024..14eb085bc3 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -51,14 +51,14 @@ Y_UNIT_TEST_SUITE(TYMapTest) { UNIT_ASSERT(m.count('z') == 1); - std::pair<typename maptype::iterator, bool> p = m.insert(std::pair<const char, int>('c', 100)); + std::pair<typename maptype::iterator, bool> p = m.insert(std::pair<const char, int>('c', 100)); UNIT_ASSERT(p.second); UNIT_ASSERT(p.first != m.end()); UNIT_ASSERT((*p.first).first == 'c'); UNIT_ASSERT((*p.first).second == 100); - p = m.insert(std::pair<const char, int>('c', 100)); + p = m.insert(std::pair<const char, int>('c', 100)); UNIT_ASSERT(!p.second); // already existing pair UNIT_ASSERT(p.first != m.end()); @@ -72,13 +72,13 @@ Y_UNIT_TEST_SUITE(TYMapTest) { UNIT_ASSERT(m.count('X') == 0); - m.insert(std::pair<const char, int>('X', 10)); // Standard way. + m.insert(std::pair<const char, int>('X', 10)); // Standard way. UNIT_ASSERT(m.count('X') == 1); - m.insert(std::pair<const char, int>('X', 20)); // jbuck: standard way + m.insert(std::pair<const char, int>('X', 20)); // jbuck: standard way UNIT_ASSERT(m.count('X') == 2); - m.insert(std::pair<const char, int>('Y', 32)); // jbuck: standard way + m.insert(std::pair<const char, int>('Y', 32)); // jbuck: standard way typename mmap::iterator i = m.find('X'); // Find first match. ++i; UNIT_ASSERT((*i).first == 'X'); @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestMMap2) { - using pair_type = std::pair<const int, char>; + using pair_type = std::pair<const int, char>; pair_type p1(3, 'c'); pair_type p2(6, 'f'); @@ -194,7 +194,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { maptype m; m['x'] = 10; - std::pair<maptype::iterator, maptype::iterator> ret; + std::pair<maptype::iterator, maptype::iterator> ret; ret = m.equal_range('x'); UNIT_ASSERT(ret.first != ret.second); UNIT_ASSERT((*(ret.first)).first == 'x'); @@ -212,7 +212,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { i = m.upper_bound('x'); UNIT_ASSERT(i == m.end()); - std::pair<maptype::iterator, maptype::iterator> ret; + std::pair<maptype::iterator, maptype::iterator> ret; ret = m.equal_range('x'); UNIT_ASSERT(ret.first == ret.second); UNIT_ASSERT(ret.first == m.end()); @@ -220,7 +220,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { { const maptype m; - std::pair<maptype::const_iterator, maptype::const_iterator> ret; + std::pair<maptype::const_iterator, maptype::const_iterator> ret; ret = m.equal_range('x'); UNIT_ASSERT(ret.first == ret.second); UNIT_ASSERT(ret.first == m.end()); @@ -357,7 +357,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { UNIT_ASSERT(ccont.find(2) != ccont.end()); UNIT_ASSERT(ccont.lower_bound(2) != ccont.end()); UNIT_ASSERT(ccont.upper_bound(2) != ccont.end()); - UNIT_ASSERT(ccont.equal_range(2) != std::make_pair(ccont.end(), ccont.end())); + UNIT_ASSERT(ccont.equal_range(2) != std::make_pair(ccont.end(), ccont.end())); } { @@ -430,9 +430,9 @@ Y_UNIT_TEST_SUITE(TYMapTest) { Container c(direct); c = Container(inverse); - c.insert(std::make_pair(TKey(1), 101)); - c.insert(std::make_pair(TKey(2), 102)); - c.insert(std::make_pair(TKey(3), 103)); + c.insert(std::make_pair(TKey(1), 101)); + c.insert(std::make_pair(TKey(2), 102)); + c.insert(std::make_pair(TKey(3), 103)); TVector<int> values; for (auto& i : c) { diff --git a/util/generic/set_ut.cpp b/util/generic/set_ut.cpp index d2769d327f..fe51cc44c0 100644 --- a/util/generic/set_ut.cpp +++ b/util/generic/set_ut.cpp @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { Y_UNIT_TEST(TestSet2) { using int_set = TSet<int, TLess<int>>; int_set s; - std::pair<int_set::iterator, bool> p = s.insert(42); + std::pair<int_set::iterator, bool> p = s.insert(42); UNIT_ASSERT(p.second == true); p = s.insert(42); UNIT_ASSERT(p.second == false); diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h index d165bd1a06..604d2591a4 100644 --- a/util/generic/typetraits.h +++ b/util/generic/typetraits.h @@ -6,7 +6,7 @@ #include <iterator> #include <type_traits> -#include <stlfwd> +#include <stlfwd> #if _LIBCPP_STD_VER >= 17 template <bool B> @@ -228,12 +228,12 @@ class TTypeTraits<void>: public TTypeTraitsBase<void> {}; */ #define Y_HAS_SUBTYPE(...) Y_PASS_VA_ARGS(Y_MACRO_IMPL_DISPATCHER_2(__VA_ARGS__, Y_HAS_SUBTYPE_IMPL_2, Y_HAS_SUBTYPE_IMPL_1)(__VA_ARGS__)) -template <class T1, class T2> -struct TPodTraits<std::pair<T1, T2>> { - enum { - IsPod = TTypeTraits<T1>::IsPod && TTypeTraits<T2>::IsPod - }; -}; +template <class T1, class T2> +struct TPodTraits<std::pair<T1, T2>> { + enum { + IsPod = TTypeTraits<T1>::IsPod && TTypeTraits<T2>::IsPod + }; +}; template <class T> struct TIsPointerToConstMemberFunction: std::false_type { diff --git a/util/generic/vector.h b/util/generic/vector.h index a5b258955a..4f9e7f715e 100644 --- a/util/generic/vector.h +++ b/util/generic/vector.h @@ -106,8 +106,8 @@ public: return TBase::empty(); } - inline yssize_t ysize() const noexcept { - return (yssize_t)TBase::size(); + inline yssize_t ysize() const noexcept { + return (yssize_t)TBase::size(); } #ifdef _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED |