QScopedArrayPointer Class▲
-
Header: QScopedArrayPointer
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
-
qmake: QT += core
-
Inherits: QScopedPointer
-
Group: QScopedArrayPointer is part of misc
Detailed Description▲
A QScopedArrayPointer is a QScopedPointer that defaults to deleting the object it is pointing to with the delete[] operator. It also features operator[] for convenience, so we can write:
void
foo()
{
QScopedArrayPointer&
lt;int
&
gt; i(new
int
[10
]);
i[2
] =
42
;
...
return
; // our integer array is now deleted using delete[]
}
Member Function Documentation▲
QScopedArrayPointer::QScopedArrayPointer()▲
Constructs a QScopedArrayPointer instance.
[explicit] QScopedArrayPointer::QScopedArrayPointer(D *p)▲
Constructs a QScopedArrayPointer and stores the array of objects pointed to by p.
void QScopedArrayPointer::swap(QScopedArrayPointer<T, Cleanup> &other)▲
Swap this pointer with other.
T &QScopedArrayPointer::operator[](int i)▲
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is nullptr, behavior is undefined.
See Also▲
See also isNull()