QScopedArrayPointer 类存储动态分配对象数组的指针,并在销毁时删除它。 更多...
头: | #include <QScopedArrayPointer> |
qmake: | QT += core |
Since: | Qt 4.6 |
继承: | QScopedPointer |
该类在 Qt 4.6 引入。
注意: 此类的所有函数 可重入 .
QScopedArrayPointer (D * p ) | |
QScopedArrayPointer () | |
void | swap (QScopedArrayPointer<T, Cleanup> & other ) |
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.
Swap this pointer with other .
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is
nullptr
, behavior is undefined.
另请参阅 isNull ().
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is
nullptr
behavior is undefined.
另请参阅 isNull ().