45 #include <type_traits>
47 VTK_ABI_NAMESPACE_BEGIN
72 template <
typename U = T>
73 static void CheckTypes() noexcept
76 "vtkNew<T>'s T type has not been defined. Missing include?");
78 "Cannot store an object with undefined type in "
79 "vtkNew. Missing include?");
81 "Argument type is not compatible with vtkNew<T>'s "
84 "vtkNew can only be used with subclasses of vtkObjectBase.");
108 template <
typename U>
112 vtkNew::CheckTypes<U>();
150 operator T*()
const noexcept {
return static_cast<T*
>(this->
Object); }
166 this->
Object = other.Object;
167 other.Object =
nullptr;
174 friend void vtkGarbageCollectorReport<T>(
179 VTK_ABI_NAMESPACE_END
~vtkNew()
Deletes reference to instance of T.
void vtkGarbageCollectorReport(vtkGarbageCollector *collector, vtkNew< T > &ptr, const char *desc)
Function to report a reference held by a vtkNew to a collector.
void Reset()
Deletes reference to instance of T.
T * Get() const noexcept
Get a raw pointer to the contained object.
vtkNew(vtkNew &&o) noexcept
Move the object into the constructed vtkNew wrapper, stealing its reference.
vtkNew()
Create a new T on construction.
vtkNew< T > & operator=(vtkNew< T > &&other) noexcept
Move assignment operator.
Hold a reference to a vtkObjectBase instance.
Detect and break reference loops.
T * operator->() const noexcept
Enable pointer-like dereference syntax.
a weak reference to a vtkObject.
abstract base class for most VTK objects
vtkNew(vtkNew< U > &&o) noexcept
Move the object into the constructed vtkNew wrapper, stealing its reference.
Allocate and hold a VTK object.
T & operator*() const noexcept
Dereference the pointer and return a reference to the contained object.
T * GetPointer() const noexcept
Get a raw pointer to the contained object.
virtual void Delete()
Delete a VTK object.