The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction. More...
Header: | #include <QScopedArrayPointer> |
CMake: | find_package(Qt6 COMPONENTS Core REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Inherits: | QScopedPointer |
Note: All functions in this class are reentrant.
QScopedArrayPointer(D *p) | |
QScopedArrayPointer() | |
T & | operator[](int i) |
const T & | operator[](int i) const |
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<int> i(new int[10]); i[2] = 42; ... return; // our integer array is now deleted using delete[] }
Constructs a QScopedArrayPointer and stores the array of objects pointed to by p.
Constructs a QScopedArrayPointer instance.
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is nullptr
, behavior is undefined.
See also isNull().
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is nullptr
behavior is undefined.
See also isNull().
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qscopedarraypointer.html