MCPcopy Create free account
hub / github.com/catboost/catboost / TCopyPtr

Class TCopyPtr

util/generic/ptr.h:1070–1140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1068
1069template <class T, class C, class D>
1070class TCopyPtr: public TPointerBase<TCopyPtr<T, C, D>, T> {
1071public:
1072 inline TCopyPtr(T* t = nullptr) noexcept
1073 : T_(t)
1074 {
1075 }
1076
1077 inline TCopyPtr(const TCopyPtr& t)
1078 : T_(C::Copy(t.Get()))
1079 {
1080 }
1081
1082 inline TCopyPtr(TCopyPtr&& t) noexcept
1083 : T_(nullptr)
1084 {
1085 Swap(t);
1086 }
1087
1088 inline ~TCopyPtr() {
1089 DoDestroy();
1090 }
1091
1092 inline TCopyPtr& operator=(TCopyPtr t) noexcept {
1093 t.Swap(*this);
1094
1095 return *this;
1096 }
1097
1098 inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
1099 return DoRelease(T_);
1100 }
1101
1102 Y_REINITIALIZES_OBJECT inline void Reset(T* t) noexcept {
1103 if (T_ != t) {
1104 DoDestroy();
1105 T_ = t;
1106 }
1107 }
1108
1109 Y_REINITIALIZES_OBJECT inline void Reset() noexcept {
1110 Destroy();
1111 }
1112
1113 inline void Destroy() noexcept {
1114 Reset(nullptr);
1115 }
1116
1117 inline void Swap(TCopyPtr& r) noexcept {
1118 DoSwap(T_, r.T_);
1119 }
1120
1121 inline T* Get() const noexcept {
1122 return T_;
1123 }
1124
1125#ifdef __cpp_impl_three_way_comparison
1126 template <class Other>
1127 inline bool operator==(const Other& p) const noexcept {

Callers

nothing calls this directly

Calls 1

SwapMethod · 0.45

Tested by

no test coverage detected