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

Class TSharedPtr

util/generic/ptr.h:840–1015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838
839template <class T, class C, class D>
840class TSharedPtr: public TPointerBase<TSharedPtr<T, C, D>, T> {
841 template <class TT, class CC, class DD>
842 friend class TSharedPtr;
843
844public:
845 inline TSharedPtr() noexcept
846 : T_(nullptr)
847 , C_(nullptr)
848 {
849 }
850
851 inline TSharedPtr(T* t) {
852 THolder<T, D> h(t);
853
854 Init(h);
855 }
856
857 inline TSharedPtr(TAutoPtr<T, D> t) {
858 Init(t);
859 }
860
861 inline TSharedPtr(T* t, C* c) noexcept
862 : T_(t)
863 , C_(c)
864 {
865 }
866
867 template <class TT, class = TGuardConversion<T, TT>>
868 inline TSharedPtr(THolder<TT>&& t) {
869 Init(t);
870 }
871
872 inline ~TSharedPtr() {
873 UnRef();
874 }
875
876 inline TSharedPtr(const TSharedPtr& t) noexcept
877 : T_(t.T_)
878 , C_(t.C_)
879 {
880 Ref();
881 }
882
883 inline TSharedPtr(TSharedPtr&& t) noexcept
884 : T_(nullptr)
885 , C_(nullptr)
886 {
887 Swap(t);
888 }
889
890 template <class TT, class = TGuardConversion<T, TT>>
891 inline TSharedPtr(const TSharedPtr<TT, C, D>& t) noexcept
892 : T_(t.T_)
893 , C_(t.C_)
894 {
895 Ref();
896 }
897

Callers 1

DropMethod · 0.70

Calls 1

SwapMethod · 0.45

Tested by

no test coverage detected