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)
POINTEE * Delete() const
Delete the object pointed to.
Namespace for new ROOT classes and functions.
TCoopPtr(POINTEE &&obj)
Create a TCoopPtr from an object.
TCoopPtr< POINTEE > MakeCoop(ARGS &&...args)
Create an object of type POINTEE on the heap, and build a TCoopPtr for it.
TCoopPtr(const TCoopPtr< DERIVED > &derived)
Conversion from a pointer to derived to a pointer to base.
Pointer_t operator->() const
Access the object pointed to.
std::shared_ptr< void * > SharedPtr_t
The underlying std::shared_ptr.
~TCoopPtrTypeErased() final=default
const SharedPtr_t & GetShared() const
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...
TCoopPtr(Pointer_t ptr)
Initialize from a raw pointer.
To handle polymorphic TCoopPtr
s, convert them to TCoopPtrTypeEraseds and access the...
POINTEE & operator*() const
Dereference the object pointed to.
typedef void((*Func_t)())
Pointer_t Get() const
Get the raw pointer.
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.
Several pointers point to the same object, any of them can delete the object, setting all of them to ...