diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-01-31 17:22:33 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-01-31 17:22:33 +0300 |
commit | 52be5dbdd420165c68e7e90ba8f1d2f00da041f6 (patch) | |
tree | 5d47f5b2ff4e6a7c8e75d33931a1e683949b7229 /library | |
parent | ea57c8867ceca391357c3c5ffcc5ba6738b49adc (diff) | |
parent | 809f0cf2fdfddfbeacc2256ffdbaaf5808ce5ed4 (diff) | |
download | ydb-52be5dbdd420165c68e7e90ba8f1d2f00da041f6.tar.gz |
Merge branch 'mergelibs12' into main
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/tld/tlds-alpha-by-domain.txt | 2 | ||||
-rw-r--r-- | library/cpp/yt/containers/enum_indexed_array-inl.h (renamed from library/cpp/yt/misc/enum_indexed_array-inl.h) | 0 | ||||
-rw-r--r-- | library/cpp/yt/containers/enum_indexed_array.h (renamed from library/cpp/yt/misc/enum_indexed_array.h) | 2 | ||||
-rw-r--r-- | library/cpp/yt/containers/unittests/enum_indexed_array_ut.cpp (renamed from library/cpp/yt/misc/unittests/enum_indexed_array_ut.cpp) | 2 | ||||
-rw-r--r-- | library/cpp/yt/containers/unittests/sharded_set_ut.cpp | 6 | ||||
-rw-r--r-- | library/cpp/yt/containers/unittests/ya.make | 5 | ||||
-rw-r--r-- | library/cpp/yt/misc/enum-inl.h | 61 | ||||
-rw-r--r-- | library/cpp/yt/misc/enum.h | 46 | ||||
-rw-r--r-- | library/cpp/yt/misc/unittests/ya.make | 1 | ||||
-rw-r--r-- | library/cpp/yt/misc/ya.make | 1 | ||||
-rw-r--r-- | library/cpp/yt/string/format-inl.h | 24 | ||||
-rw-r--r-- | library/cpp/yt/string/unittests/enum_ut.cpp | 1 | ||||
-rw-r--r-- | library/cpp/ytalloc/api/ya.make | 1 | ||||
-rw-r--r-- | library/cpp/ytalloc/api/ytalloc.h | 3 | ||||
-rw-r--r-- | library/rightlib_sha.txt | 2 |
15 files changed, 17 insertions, 140 deletions
diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt index 76fbd16e7b..15a2c09f55 100644 --- a/library/cpp/tld/tlds-alpha-by-domain.txt +++ b/library/cpp/tld/tlds-alpha-by-domain.txt @@ -1,4 +1,4 @@ -# Version 2024012400, Last Updated Wed Jan 24 07:07:01 2024 UTC +# Version 2024012700, Last Updated Sat Jan 27 07:07:01 2024 UTC AAA AARP ABB diff --git a/library/cpp/yt/misc/enum_indexed_array-inl.h b/library/cpp/yt/containers/enum_indexed_array-inl.h index edda891683..edda891683 100644 --- a/library/cpp/yt/misc/enum_indexed_array-inl.h +++ b/library/cpp/yt/containers/enum_indexed_array-inl.h diff --git a/library/cpp/yt/misc/enum_indexed_array.h b/library/cpp/yt/containers/enum_indexed_array.h index 8992456277..bae6a75237 100644 --- a/library/cpp/yt/misc/enum_indexed_array.h +++ b/library/cpp/yt/containers/enum_indexed_array.h @@ -1,6 +1,6 @@ #pragma once -#include "enum.h" +#include <library/cpp/yt/misc/enum.h> namespace NYT { diff --git a/library/cpp/yt/misc/unittests/enum_indexed_array_ut.cpp b/library/cpp/yt/containers/unittests/enum_indexed_array_ut.cpp index 4111c6f4fe..a87c417d7d 100644 --- a/library/cpp/yt/misc/unittests/enum_indexed_array_ut.cpp +++ b/library/cpp/yt/containers/unittests/enum_indexed_array_ut.cpp @@ -1,6 +1,6 @@ #include <library/cpp/testing/gtest/gtest.h> -#include <library/cpp/yt/misc/enum_indexed_array.h> +#include <library/cpp/yt/containers/enum_indexed_array.h> namespace NYT { namespace { diff --git a/library/cpp/yt/containers/unittests/sharded_set_ut.cpp b/library/cpp/yt/containers/unittests/sharded_set_ut.cpp index 2c4f8c5935..a954ea5151 100644 --- a/library/cpp/yt/containers/unittests/sharded_set_ut.cpp +++ b/library/cpp/yt/containers/unittests/sharded_set_ut.cpp @@ -21,7 +21,7 @@ using TSet = TShardedSet<int, 16, TIntToShard>; //////////////////////////////////////////////////////////////////////////////// -TEST(CompactSetTest, Insert) +TEST(TShardedSetTest, Insert) { TSet set; @@ -41,7 +41,7 @@ TEST(CompactSetTest, Insert) EXPECT_EQ(0u, set.count(4)); } -TEST(CompactSetTest, Erase) +TEST(TShardedSetTest, Erase) { TSet set; @@ -65,7 +65,7 @@ TEST(CompactSetTest, Erase) EXPECT_EQ(0u, set.count(8)); } -TEST(CompactSetTest, StressTest) +TEST(TShardedSetTest, StressTest) { TSet set; diff --git a/library/cpp/yt/containers/unittests/ya.make b/library/cpp/yt/containers/unittests/ya.make index 3e7cfd4311..3ffc420658 100644 --- a/library/cpp/yt/containers/unittests/ya.make +++ b/library/cpp/yt/containers/unittests/ya.make @@ -1,8 +1,11 @@ -GTEST(unittester-containers) +GTEST() INCLUDE(${ARCADIA_ROOT}/library/cpp/yt/ya_cpp.make.inc) +SIZE(MEDIUM) + SRCS( + enum_indexed_array_ut.cpp sharded_set_ut.cpp ) diff --git a/library/cpp/yt/misc/enum-inl.h b/library/cpp/yt/misc/enum-inl.h index 02493d7ac5..5e1d04da1f 100644 --- a/library/cpp/yt/misc/enum-inl.h +++ b/library/cpp/yt/misc/enum-inl.h @@ -302,67 +302,6 @@ T TEnumTraits<T, true>::FromString(TStringBuf literal) //////////////////////////////////////////////////////////////////////////////// -template <class E, class T, E Min, E Max> -constexpr TEnumIndexedVector<E, T, Min, Max>::TEnumIndexedVector() - : Items_{} -{ } - -template <class E, class T, E Min, E Max> -constexpr TEnumIndexedVector<E, T, Min, Max>::TEnumIndexedVector(std::initializer_list<T> elements) - : Items_{} -{ - Y_ASSERT(std::distance(elements.begin(), elements.end()) <= N); - size_t index = 0; - for (const auto& element : elements) { - Items_[index++] = element; - } -} - -template <class E, class T, E Min, E Max> -T& TEnumIndexedVector<E, T, Min, Max>::operator[] (E index) -{ - Y_ASSERT(index >= Min && index <= Max); - return Items_[ToUnderlying(index) - ToUnderlying(Min)]; -} - -template <class E, class T, E Min, E Max> -const T& TEnumIndexedVector<E, T, Min, Max>::operator[] (E index) const -{ - return const_cast<TEnumIndexedVector&>(*this)[index]; -} - -template <class E, class T, E Min, E Max> -T* TEnumIndexedVector<E, T, Min, Max>::begin() -{ - return Items_.data(); -} - -template <class E, class T, E Min, E Max> -const T* TEnumIndexedVector<E, T, Min, Max>::begin() const -{ - return Items_.data(); -} - -template <class E, class T, E Min, E Max> -T* TEnumIndexedVector<E, T, Min, Max>::end() -{ - return begin() + N; -} - -template <class E, class T, E Min, E Max> -const T* TEnumIndexedVector<E, T, Min, Max>::end() const -{ - return begin() + N; -} - -template <class E, class T, E Min, E Max> -bool TEnumIndexedVector<E, T, Min, Max>::IsDomainValue(E value) -{ - return value >= Min && value <= Max; -} - -//////////////////////////////////////////////////////////////////////////////// - #define ENUM__BINARY_BITWISE_OPERATOR(T, assignOp, op) \ [[maybe_unused]] inline constexpr T operator op (T lhs, T rhs) \ { \ diff --git a/library/cpp/yt/misc/enum.h b/library/cpp/yt/misc/enum.h index 9da79b9fd3..954b63cbc0 100644 --- a/library/cpp/yt/misc/enum.h +++ b/library/cpp/yt/misc/enum.h @@ -185,52 +185,6 @@ struct TEnumTraits<T, true> //////////////////////////////////////////////////////////////////////////////// -// TODO(babenko): drop in favor of TEnumIndexedArray -//! A statically sized vector with elements of type |T| indexed by -//! the items of enumeration type |E|. -/*! - * Items are value-initialized on construction. - */ -template < - class E, - class T, - E Min = TEnumTraits<E>::GetMinValue(), - E Max = TEnumTraits<E>::GetMaxValue() -> -class TEnumIndexedVector -{ -public: - using TIndex = E; - using TValue = T; - - constexpr TEnumIndexedVector(); - constexpr TEnumIndexedVector(std::initializer_list<T> elements); - - constexpr TEnumIndexedVector(const TEnumIndexedVector&) = default; - constexpr TEnumIndexedVector(TEnumIndexedVector&&) noexcept = default; - - constexpr TEnumIndexedVector& operator=(const TEnumIndexedVector&) = default; - constexpr TEnumIndexedVector& operator=(TEnumIndexedVector&&) noexcept = default; - - T& operator[] (E index); - const T& operator[] (E index) const; - - // STL interop. - T* begin(); - const T* begin() const; - T* end(); - const T* end() const; - - static bool IsDomainValue(E value); - -private: - using TUnderlying = std::underlying_type_t<E>; - static constexpr int N = static_cast<TUnderlying>(Max) - static_cast<TUnderlying>(Min) + 1; - std::array<T, N> Items_; -}; - -//////////////////////////////////////////////////////////////////////////////// - //! Returns |true| iff the enumeration value is not bitwise zero. template <typename E> requires TEnumTraits<E>::IsBitEnum diff --git a/library/cpp/yt/misc/unittests/ya.make b/library/cpp/yt/misc/unittests/ya.make index 43e9f9b9ff..611edd7217 100644 --- a/library/cpp/yt/misc/unittests/ya.make +++ b/library/cpp/yt/misc/unittests/ya.make @@ -4,7 +4,6 @@ INCLUDE(${ARCADIA_ROOT}/library/cpp/yt/ya_cpp.make.inc) SRCS( enum_ut.cpp - enum_indexed_array_ut.cpp guid_ut.cpp preprocessor_ut.cpp strong_typedef_ut.cpp diff --git a/library/cpp/yt/misc/ya.make b/library/cpp/yt/misc/ya.make index 586d14f6ee..841930aaa2 100644 --- a/library/cpp/yt/misc/ya.make +++ b/library/cpp/yt/misc/ya.make @@ -11,6 +11,7 @@ SRCS( PEERDIR( library/cpp/yt/exception + library/cpp/yt/assert ) CHECK_DEPENDENT_DIRS( diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h index c198fdcd65..85e82b473e 100644 --- a/library/cpp/yt/string/format-inl.h +++ b/library/cpp/yt/string/format-inl.h @@ -11,8 +11,9 @@ #include <library/cpp/yt/small_containers/compact_vector.h> +#include <library/cpp/yt/containers/enum_indexed_array.h> + #include <library/cpp/yt/misc/enum.h> -#include <library/cpp/yt/misc/enum_indexed_array.h> #include <util/system/platform.h> @@ -415,27 +416,6 @@ struct TValueFormatter<TEnumIndexedArray<E, T>> } }; -// TEnumIndexedVector -template <class E, class T> -struct TValueFormatter<TEnumIndexedVector<E, T>> -{ - static void Do(TStringBuilderBase* builder, const TEnumIndexedVector<E, T>& collection, TStringBuf format) - { - builder->AppendChar('{'); - bool firstItem = true; - for (const auto& index : TEnumTraits<E>::GetDomainValues()) { - if (!firstItem) { - builder->AppendString(DefaultJoinToStringDelimiter); - } - FormatValue(builder, index, format); - builder->AppendString(": "); - FormatValue(builder, collection[index], format); - firstItem = false; - } - builder->AppendChar('}'); - } -}; - // std::pair template <class T1, class T2> struct TValueFormatter<std::pair<T1, T2>> diff --git a/library/cpp/yt/string/unittests/enum_ut.cpp b/library/cpp/yt/string/unittests/enum_ut.cpp index 91a8b04500..2c368e85d4 100644 --- a/library/cpp/yt/string/unittests/enum_ut.cpp +++ b/library/cpp/yt/string/unittests/enum_ut.cpp @@ -14,7 +14,6 @@ namespace { DEFINE_ENUM(ESample, (One)(Two)); static_assert(TFormatTraits<ESample>::HasCustomFormatValue); static_assert(TFormatTraits<TEnumIndexedArray<ESample, int>>::HasCustomFormatValue); -static_assert(TFormatTraits<TEnumIndexedVector<ESample, int>>::HasCustomFormatValue); DEFINE_ENUM(EColor, (Red) diff --git a/library/cpp/ytalloc/api/ya.make b/library/cpp/ytalloc/api/ya.make index 7e7852df14..9cec6be14c 100644 --- a/library/cpp/ytalloc/api/ya.make +++ b/library/cpp/ytalloc/api/ya.make @@ -6,6 +6,7 @@ SRCS( PEERDIR( library/cpp/yt/misc + library/cpp/yt/containers ) END() diff --git a/library/cpp/ytalloc/api/ytalloc.h b/library/cpp/ytalloc/api/ytalloc.h index 43ba48852d..38879074dd 100644 --- a/library/cpp/ytalloc/api/ytalloc.h +++ b/library/cpp/ytalloc/api/ytalloc.h @@ -3,7 +3,8 @@ #include <stddef.h> #include <library/cpp/yt/misc/enum.h> -#include <library/cpp/yt/misc/enum_indexed_array.h> + +#include <library/cpp/yt/containers/enum_indexed_array.h> #include <util/system/types.h> diff --git a/library/rightlib_sha.txt b/library/rightlib_sha.txt index 5bfd2b763b..8eca80cba6 100644 --- a/library/rightlib_sha.txt +++ b/library/rightlib_sha.txt @@ -1 +1 @@ -f6d7ec162ce757a854f4a619d6b0c7084ad48f3e +0ff1123e2bd6d1424be6f5d21ad6f390b4fd5ac8 |