aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/ptr.h
diff options
context:
space:
mode:
authoreeight <eeight@yandex-team.ru>2022-02-10 16:46:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:19 +0300
commitbd085aee9b4f7a0bee302ce687964ffb7098f986 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/generic/ptr.h
parent475c0a46f28166e83fd263badc7546377cddcabe (diff)
downloadydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/ptr.h')
-rw-r--r--util/generic/ptr.h88
1 files changed, 44 insertions, 44 deletions
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index f38a3e44ca..19db0e3ec5 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -12,9 +12,9 @@
#include <util/system/yassert.h>
#include <util/system/defaults.h>
-template <class T, class U>
-using TGuardConversion = typename std::enable_if_t<std::is_convertible<U*, T*>::value>;
-
+template <class T, class U>
+using TGuardConversion = typename std::enable_if_t<std::is_convertible<U*, T*>::value>;
+
template <class T>
inline void AssertTypeComplete() {
// If compiler triggers this error from destructor of your class with
@@ -242,7 +242,7 @@ public:
{
}
- explicit THolder(T* t) noexcept
+ explicit THolder(T* t) noexcept
: T_(t)
{
}
@@ -252,7 +252,7 @@ public:
{
}
- template <class U, class = TGuardConversion<T, U>>
+ template <class U, class = TGuardConversion<T, U>>
inline THolder(TAutoPtr<U, D> t) noexcept
: T_(t.Release())
{
@@ -263,7 +263,7 @@ public:
{
}
- template <class U, class = TGuardConversion<T, U>>
+ template <class U, class = TGuardConversion<T, U>>
inline THolder(THolder<U, D>&& that) noexcept
: T_(that.Release())
{
@@ -346,7 +346,7 @@ private:
template <typename T, typename... Args>
[[nodiscard]] THolder<T> MakeHolder(Args&&... args) {
- return THolder<T>(new T(std::forward<Args>(args)...));
+ return THolder<T>(new T(std::forward<Args>(args)...));
}
/*
@@ -475,12 +475,12 @@ public:
template <class T, class Ops>
class TIntrusivePtr: public TPointerBase<TIntrusivePtr<T, Ops>, T> {
- template <class U, class O>
- friend class TIntrusivePtr;
+ template <class U, class O>
+ friend class TIntrusivePtr;
+
+ template <class U, class O>
+ friend class TIntrusiveConstPtr;
- template <class U, class O>
- friend class TIntrusiveConstPtr;
-
public:
struct TNoIncrement {
};
@@ -517,20 +517,20 @@ public:
// void Func(TIntrusivePtr<B>);
// ...
// Func(TIntrusivePtr<A>(new A)); // <--- compiler can't decide which version of Func to use
- template <class U, class = TGuardConversion<T, U>>
- inline TIntrusivePtr(const TIntrusivePtr<U>& p) noexcept
+ template <class U, class = TGuardConversion<T, U>>
+ inline TIntrusivePtr(const TIntrusivePtr<U>& p) noexcept
: T_(p.Get())
{
Ref();
}
- template <class U, class = TGuardConversion<T, U>>
- inline TIntrusivePtr(TIntrusivePtr<U>&& p) noexcept
- : T_(p.T_)
- {
- p.T_ = nullptr;
- }
-
+ template <class U, class = TGuardConversion<T, U>>
+ inline TIntrusivePtr(TIntrusivePtr<U>&& p) noexcept
+ : T_(p.T_)
+ {
+ p.T_ = nullptr;
+ }
+
inline TIntrusivePtr(TIntrusivePtr&& p) noexcept
: T_(nullptr)
{
@@ -637,26 +637,26 @@ public:
Swap(p);
}
- inline TIntrusiveConstPtr(TIntrusivePtr<T> p) noexcept
- : T_(p.T_)
+ inline TIntrusiveConstPtr(TIntrusivePtr<T> p) noexcept
+ : T_(p.T_)
{
- p.T_ = nullptr;
+ p.T_ = nullptr;
}
- template <class U, class = TGuardConversion<T, U>>
- inline TIntrusiveConstPtr(const TIntrusiveConstPtr<U>& p) noexcept
+ template <class U, class = TGuardConversion<T, U>>
+ inline TIntrusiveConstPtr(const TIntrusiveConstPtr<U>& p) noexcept
: T_(p.T_)
{
Ref();
}
- template <class U, class = TGuardConversion<T, U>>
- inline TIntrusiveConstPtr(TIntrusiveConstPtr<U>&& p) noexcept
- : T_(p.T_)
- {
- p.T_ = nullptr;
- }
-
+ template <class U, class = TGuardConversion<T, U>>
+ inline TIntrusiveConstPtr(TIntrusiveConstPtr<U>&& p) noexcept
+ : T_(p.T_)
+ {
+ p.T_ = nullptr;
+ }
+
inline TIntrusiveConstPtr& operator=(TIntrusiveConstPtr p) noexcept {
p.Swap(*this);
@@ -816,7 +816,7 @@ public:
{
}
- template <class TT, class = TGuardConversion<T, TT>>
+ template <class TT, class = TGuardConversion<T, TT>>
inline TSharedPtr(THolder<TT>&& t) {
Init(t);
}
@@ -839,7 +839,7 @@ public:
Swap(t);
}
- template <class TT, class = TGuardConversion<T, TT>>
+ template <class TT, class = TGuardConversion<T, TT>>
inline TSharedPtr(const TSharedPtr<TT, C, D>& t) noexcept
: T_(t.T_)
, C_(t.C_)
@@ -847,15 +847,15 @@ public:
Ref();
}
- template <class TT, class = TGuardConversion<T, TT>>
- inline TSharedPtr(TSharedPtr<TT, C, D>&& t) noexcept
- : T_(t.T_)
- , C_(t.C_)
- {
- t.T_ = nullptr;
- t.C_ = nullptr;
- }
-
+ template <class TT, class = TGuardConversion<T, TT>>
+ inline TSharedPtr(TSharedPtr<TT, C, D>&& t) noexcept
+ : T_(t.T_)
+ , C_(t.C_)
+ {
+ t.T_ = nullptr;
+ t.C_ = nullptr;
+ }
+
inline TSharedPtr& operator=(TSharedPtr t) noexcept {
t.Swap(*this);