From 4d9954dde66b7a3383ca8cfa5540bf5bfbb19c54 Mon Sep 17 00:00:00 2001 From: sabdenovch Date: Mon, 28 Aug 2023 18:11:46 +0300 Subject: Removed the last typedefs in the codebase removed a lot of typedefs and turned a couple of std::pairs into something more meaningful --- library/cpp/yt/memory/intrusive_ptr.h | 2 +- library/cpp/yt/memory/new.h | 2 +- library/cpp/yt/memory/range.h | 8 ++++---- library/cpp/yt/memory/unittests/atomic_intrusive_ptr_ut.cpp | 4 ++-- library/cpp/yt/memory/unittests/intrusive_ptr_ut.cpp | 4 ++-- library/cpp/yt/memory/unittests/weak_ptr_ut.cpp | 12 ++++++------ library/cpp/yt/memory/weak_ptr.h | 2 +- .../cpp/yt/small_containers/unittests/compact_vector_ut.cpp | 8 ++++---- 8 files changed, 21 insertions(+), 21 deletions(-) (limited to 'library/cpp') diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h index 788abea08f8..1da3b06966f 100644 --- a/library/cpp/yt/memory/intrusive_ptr.h +++ b/library/cpp/yt/memory/intrusive_ptr.h @@ -16,7 +16,7 @@ template class TIntrusivePtr { public: - typedef T TUnderlying; + using TUnderlying = T; constexpr TIntrusivePtr() noexcept { } diff --git a/library/cpp/yt/memory/new.h b/library/cpp/yt/memory/new.h index 7108b0e7a0b..a9591724edc 100644 --- a/library/cpp/yt/memory/new.h +++ b/library/cpp/yt/memory/new.h @@ -28,7 +28,7 @@ namespace NYT { * TFoo(); * }; * - * typedef TIntrusivePtr TFooPtr; + * using TFooPtr = TIntrusivePtr; * * void RegisterObject(TFooPtr foo) * { diff --git a/library/cpp/yt/memory/range.h b/library/cpp/yt/memory/range.h index ac1f138b303..5881fc3fbfb 100644 --- a/library/cpp/yt/memory/range.h +++ b/library/cpp/yt/memory/range.h @@ -55,9 +55,9 @@ template class TRange { public: - typedef const T* iterator; - typedef const T* const_iterator; - typedef size_t size_type; + using iterator = const T*; + using const_iterator = const T*; + using size_type = size_t; //! Constructs a null TRange. TRange() @@ -311,7 +311,7 @@ class TMutableRange : public TRange { public: - typedef T* iterator; + using iterator = T*; //! Constructs a null TMutableRange. TMutableRange() diff --git a/library/cpp/yt/memory/unittests/atomic_intrusive_ptr_ut.cpp b/library/cpp/yt/memory/unittests/atomic_intrusive_ptr_ut.cpp index f6a26e56b15..4811d208824 100644 --- a/library/cpp/yt/memory/unittests/atomic_intrusive_ptr_ut.cpp +++ b/library/cpp/yt/memory/unittests/atomic_intrusive_ptr_ut.cpp @@ -42,8 +42,8 @@ struct TIntricateObject } }; -typedef TIntrusivePtr TIntricateObjectPtr; -typedef TIntrusivePtr TConstIntricateObjectPtr; +using TIntricateObjectPtr = TIntrusivePtr; +using TConstIntricateObjectPtr = TIntrusivePtr; void Ref(TIntricateObject* obj, int n = 1) { diff --git a/library/cpp/yt/memory/unittests/intrusive_ptr_ut.cpp b/library/cpp/yt/memory/unittests/intrusive_ptr_ut.cpp index ede5deb80aa..f20e5cff10f 100644 --- a/library/cpp/yt/memory/unittests/intrusive_ptr_ut.cpp +++ b/library/cpp/yt/memory/unittests/intrusive_ptr_ut.cpp @@ -48,7 +48,7 @@ struct TIntricateObject } }; -typedef TIntrusivePtr TIntricateObjectPtr; +using TIntricateObjectPtr = TIntrusivePtr; void Ref(TIntricateObject* obj, int /*n*/ = 1) { @@ -449,7 +449,7 @@ TEST(TIntrusivePtrTest, CompareWithNullptr) template void TestIntrusivePtrBehavior() { - typedef TIntrusivePtr TMyPtr; + using TMyPtr = TIntrusivePtr; TStringStream output; { diff --git a/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp b/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp index 6359d0bd66f..f19809100fe 100644 --- a/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp +++ b/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp @@ -63,8 +63,8 @@ private: TIntricateObject& operator=(TIntricateObject&&); }; -typedef TIntrusivePtr TIntricateObjectPtr; -typedef TWeakPtr TIntricateObjectWkPtr; +using TIntricateObjectPtr = TIntrusivePtr; +using TIntricateObjectWkPtr = TWeakPtr; class TDerivedIntricateObject : public TIntricateObject @@ -74,8 +74,8 @@ private: [[maybe_unused]] std::array Payload; }; -typedef TIntrusivePtr TDerivedIntricateObjectPtr; -typedef TWeakPtr TDerivedIntricateObjectWkPtr; +using TDerivedIntricateObjectPtr = TIntrusivePtr; +using TDerivedIntricateObjectWkPtr = TWeakPtr; MATCHER_P2(HasRefCounts, strongRefs, weakRefs, "The object has " @@ -383,8 +383,8 @@ void PrintTo(const TSlowlyDyingObject& arg, ::std::ostream* os) PrintExtrinsicRefCounted(arg, os); } -typedef TIntrusivePtr TSlowlyDyingObjectPtr; -typedef TWeakPtr TSlowlyDyingObjectWkPtr; +using TSlowlyDyingObjectPtr = TIntrusivePtr; +using TSlowlyDyingObjectWkPtr = TWeakPtr; static void* AsynchronousDeleter(void* param) { diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h index 6d2c5f0c01b..a5a7f0a525e 100644 --- a/library/cpp/yt/memory/weak_ptr.h +++ b/library/cpp/yt/memory/weak_ptr.h @@ -12,7 +12,7 @@ template class TWeakPtr { public: - typedef T TUnderlying; + using TUnderlying = T; //! Empty constructor. TWeakPtr() = default; diff --git a/library/cpp/yt/small_containers/unittests/compact_vector_ut.cpp b/library/cpp/yt/small_containers/unittests/compact_vector_ut.cpp index 1e30c0a532b..715de64dfb9 100644 --- a/library/cpp/yt/small_containers/unittests/compact_vector_ut.cpp +++ b/library/cpp/yt/small_containers/unittests/compact_vector_ut.cpp @@ -205,12 +205,12 @@ protected: }; -typedef ::testing::Types, +using CompactVectorTestTypes = ::testing::Types, TCompactVector, TCompactVector, TCompactVector, TCompactVector - > CompactVectorTestTypes; + >; TYPED_TEST_SUITE(CompactVectorTest, CompactVectorTestTypes); // New vector test. @@ -723,7 +723,7 @@ protected: static size_t NumBuiltinElts(const TCompactVector&) { return N; } }; -typedef ::testing::Types< +using DualCompactVectorTestTypes = ::testing::Types< // Small mode -> Small mode. std::pair, TCompactVector>, // Small mode -> Big mode. @@ -732,7 +732,7 @@ typedef ::testing::Types< std::pair, TCompactVector>, // Big mode -> Big mode. std::pair, TCompactVector> - > DualCompactVectorTestTypes; + >; TYPED_TEST_SUITE(DualCompactVectorsTest, DualCompactVectorTestTypes); -- cgit v1.3