78 template <
typename U = T>
79 static void CheckTypes() noexcept
82 "vtkNew<T>'s T type has not been defined. Missing include?");
84 "Cannot store an object with undefined type in "
85 "vtkNew. Missing include?");
86 static_assert(std::is_base_of<T, U>::value,
87 "Argument type is not compatible with vtkNew<T>'s "
89 static_assert(std::is_base_of<vtkObjectBase, T>::value,
90 "vtkNew can only be used with subclasses of vtkObjectBase.");
100 vtkNew::CheckTypes();
114 template <
typename U>
118 vtkNew::CheckTypes<U>();
132 T* obj = this->Object;
135 this->Object =
nullptr;
155 T*
Get() const noexcept {
return this->Object; }
156 operator T*()
const noexcept {
return static_cast<T*
>(this->Object); }
164 T&
operator*() const noexcept {
return *
static_cast<T*
>(this->Object); }
168 void operator=(
vtkNew<T> const&) =
delete;
Allocate and hold a VTK object.
void Reset()
Deletes reference to instance of T.
T * Get() const noexcept
Get a raw pointer to the contained object.
vtkNew()
Create a new T on construction.
T * operator->() const noexcept
Enable pointer-like dereference syntax.
vtkNew(vtkNew &&o) noexcept
Move the object into the constructed vtkNew wrapper, stealing its reference.
~vtkNew()
Deletes reference to instance of T.
vtkNew(vtkNew< U > &&o) noexcept
Move the object into the constructed vtkNew wrapper, stealing its reference.
T * GetPointer() const noexcept
Get a raw pointer to the contained object.
T & operator*() const noexcept
Dereference the pointer and return a reference to the contained object.
abstract base class for most VTK objects
Hold a reference to a vtkObjectBase instance.
a weak reference to a vtkObject.