diff options
author | bulatman <bulatman@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
commit | 6560e4993b14d193f8c879e33a3de5e5eba6e21d (patch) | |
tree | cfd2e2baa05c3196f2caacbb63c32e1df40bc3de /library/cpp/yt | |
parent | 7489e4682331202b9c7d863c0898eb83d7b12c2b (diff) | |
download | ydb-6560e4993b14d193f8c879e33a3de5e5eba6e21d.tar.gz |
Restoring authorship annotation for <bulatman@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt')
-rw-r--r-- | library/cpp/yt/memory/intrusive_ptr.h | 112 | ||||
-rw-r--r-- | library/cpp/yt/memory/ref_counted-inl.h | 10 | ||||
-rw-r--r-- | library/cpp/yt/memory/ref_counted.h | 6 |
3 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h index 3dead7db1d..6aa0f0dc90 100644 --- a/library/cpp/yt/memory/intrusive_ptr.h +++ b/library/cpp/yt/memory/intrusive_ptr.h @@ -223,38 +223,38 @@ Y_FORCE_INLINE TIntrusivePtr<T> DangerousGetPtr(T* object) //////////////////////////////////////////////////////////////////////////////// -template <class T, class U> -TIntrusivePtr<T> StaticPointerCast(const TIntrusivePtr<U>& ptr) -{ - return {static_cast<T*>(ptr.Get())}; -} - -template <class T, class U> -TIntrusivePtr<T> StaticPointerCast(TIntrusivePtr<U>&& ptr) -{ - return {static_cast<T*>(ptr.Release()), false}; -} - -template <class T, class U> -TIntrusivePtr<T> ConstPointerCast(const TIntrusivePtr<U>& ptr) -{ - return {const_cast<T*>(ptr.Get())}; -} - -template <class T, class U> -TIntrusivePtr<T> ConstPointerCast(TIntrusivePtr<U>&& ptr) -{ - return {const_cast<T*>(ptr.Release()), false}; -} - -template <class T, class U> -TIntrusivePtr<T> DynamicPointerCast(const TIntrusivePtr<U>& ptr) -{ - return {dynamic_cast<T*>(ptr.Get())}; -} - -//////////////////////////////////////////////////////////////////////////////// - +template <class T, class U> +TIntrusivePtr<T> StaticPointerCast(const TIntrusivePtr<U>& ptr) +{ + return {static_cast<T*>(ptr.Get())}; +} + +template <class T, class U> +TIntrusivePtr<T> StaticPointerCast(TIntrusivePtr<U>&& ptr) +{ + return {static_cast<T*>(ptr.Release()), false}; +} + +template <class T, class U> +TIntrusivePtr<T> ConstPointerCast(const TIntrusivePtr<U>& ptr) +{ + return {const_cast<T*>(ptr.Get())}; +} + +template <class T, class U> +TIntrusivePtr<T> ConstPointerCast(TIntrusivePtr<U>&& ptr) +{ + return {const_cast<T*>(ptr.Release()), false}; +} + +template <class T, class U> +TIntrusivePtr<T> DynamicPointerCast(const TIntrusivePtr<U>& ptr) +{ + return {dynamic_cast<T*>(ptr.Get())}; +} + +//////////////////////////////////////////////////////////////////////////////// + template <class T> bool operator<(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<T>& rhs) { @@ -321,30 +321,30 @@ bool operator!=(T* lhs, const TIntrusivePtr<U>& rhs) return lhs != rhs.Get(); } -template <class T> -bool operator==(std::nullptr_t, const TIntrusivePtr<T>& rhs) -{ - return nullptr == rhs.Get(); -} - -template <class T> -bool operator!=(std::nullptr_t, const TIntrusivePtr<T>& rhs) -{ - return nullptr != rhs.Get(); -} - -template <class T> -bool operator==(const TIntrusivePtr<T>& lhs, std::nullptr_t) -{ - return nullptr == lhs.Get(); -} - -template <class T> -bool operator!=(const TIntrusivePtr<T>& lhs, std::nullptr_t) -{ - return nullptr != lhs.Get(); -} - +template <class T> +bool operator==(std::nullptr_t, const TIntrusivePtr<T>& rhs) +{ + return nullptr == rhs.Get(); +} + +template <class T> +bool operator!=(std::nullptr_t, const TIntrusivePtr<T>& rhs) +{ + return nullptr != rhs.Get(); +} + +template <class T> +bool operator==(const TIntrusivePtr<T>& lhs, std::nullptr_t) +{ + return nullptr == lhs.Get(); +} + +template <class T> +bool operator!=(const TIntrusivePtr<T>& lhs, std::nullptr_t) +{ + return nullptr != lhs.Get(); +} + //////////////////////////////////////////////////////////////////////////////// } //namespace NYT diff --git a/library/cpp/yt/memory/ref_counted-inl.h b/library/cpp/yt/memory/ref_counted-inl.h index e6d64fec18..89894619bd 100644 --- a/library/cpp/yt/memory/ref_counted-inl.h +++ b/library/cpp/yt/memory/ref_counted-inl.h @@ -143,7 +143,7 @@ struct TRefCountedHelper return reinterpret_cast<const TRefCounter*>(obj) - 1; } - Y_FORCE_INLINE static void Destroy(const T* obj) + Y_FORCE_INLINE static void Destroy(const T* obj) { auto* refCounter = GetRefCounter(obj); @@ -163,7 +163,7 @@ struct TRefCountedHelper } } - Y_FORCE_INLINE static void Deallocate(const T* obj) + Y_FORCE_INLINE static void Deallocate(const T* obj) { char* ptr = reinterpret_cast<char*>(const_cast<TRefCounter*>(GetRefCounter(obj))); TMemoryReleaser<T>::Do(ptr - RefCounterOffset, RefCounterSpace); @@ -196,19 +196,19 @@ struct TRefCountedHelper<T, true> //////////////////////////////////////////////////////////////////////////////// template <class T> -Y_FORCE_INLINE const TRefCounter* GetRefCounter(const T* obj) +Y_FORCE_INLINE const TRefCounter* GetRefCounter(const T* obj) { return TRefCountedHelper<T>::GetRefCounter(obj); } template <class T> -Y_FORCE_INLINE void DestroyRefCounted(const T* obj) +Y_FORCE_INLINE void DestroyRefCounted(const T* obj) { TRefCountedHelper<T>::Destroy(obj); } template <class T> -Y_FORCE_INLINE void DeallocateRefCounted(const T* obj) +Y_FORCE_INLINE void DeallocateRefCounted(const T* obj) { TRefCountedHelper<T>::Deallocate(obj); } diff --git a/library/cpp/yt/memory/ref_counted.h b/library/cpp/yt/memory/ref_counted.h index b683615b83..2443675def 100644 --- a/library/cpp/yt/memory/ref_counted.h +++ b/library/cpp/yt/memory/ref_counted.h @@ -90,13 +90,13 @@ private: //////////////////////////////////////////////////////////////////////////////// template <class T> -const TRefCounter* GetRefCounter(const T* obj); +const TRefCounter* GetRefCounter(const T* obj); template <class T> -void DestroyRefCounted(const T* obj); +void DestroyRefCounted(const T* obj); template <class T> -void DeallocateRefCounted(const T* obj); +void DeallocateRefCounted(const T* obj); //////////////////////////////////////////////////////////////////////////////// |