15 #ifndef ROOT7_TCoopPtr 16 #define ROOT7_TCoopPtr 19 #include <type_traits> 45 template <
class POINTEE>
69 typename std::enable_if<
83 template <
class DERIVED,
84 typename std::enable_if<std::is_base_of<POINTEE, DERIVED>{}>::type* =
nullptr>
108 operator bool()
const {
return fPtrBuf.get(); }
119 template <
class POINTEE,
class...
ARGS>
129 template <
class POINTEE>
162 template<
class POINTEE>
TCoopPtrTypeErased(const TCoopPtr< POINTEE > &ptr)
Namespace for new ROOT classes and functions.
TCoopPtr(POINTEE &&obj)
Create a TCoopPtr from an object.
TCoopPtr(const TCoopPtr< DERIVED > &derived)
Conversion from a pointer to derived to a pointer to base.
std::shared_ptr< void *> SharedPtr_t
The underlying std::shared_ptr.
virtual ~TCoopPtrTypeErasedBase()
std::add_pointer_t< Pointee_t > Pointer_t
The primitive pointer type.
Type-specific derived implementation of a TCoopPtrTypeErasedBase, to invoke the destructor of the TCo...
const SharedPtr_t & GetShared() const
TCoopPtr(Pointer_t ptr)
Initialize from a raw pointer.
To handle polymorphic TCoopPtr<POINTEE>s, convert them to TCoopPtrTypeErased<POINTEE>s and access the...
typedef void((*Func_t)())
POINTEE & operator*() const
Dereference the object pointed to.
Pointer_t operator->() const
Access the object pointed to.
POINTEE * Delete() const
Delete the object pointed to.
std::remove_reference_t< ROOT::THist< DIMENSION, PRECISION > > Pointee_t
The type pointed to.
TCoopPtr(std::unique_ptr< POINTEE > &&ptr)
Initialize from a unique_ptr; takes ownership.
TCoopPtr< POINTEE > MakeCoop(ARGS &&... args)
Create an object of type POINTEE on the heap, and build a TCoopPtr for it.
Pointer_t Get() const
Get the raw pointer.
Several pointers point to the same object, any of them can delete the object, setting all of them to ...