The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction. 更多...
| 頭: | #include <QScopedArrayPointer> |
| qmake: | QT += core |
| Since: | Qt 4.6 |
| 繼承: | QScopedPointer |
注意: 此類的所有函數 可重入 .
| QScopedArrayPointer () | |
| QScopedArrayPointer (D * p ) | |
| void | swap (QScopedArrayPointer<T, Cleanup> & other ) |
| T & | operator[] (int i ) |
| const T & | operator[] (int i ) const |
The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction.
A QScopedArrayPointer 是 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[] }
構造 QScopedArrayPointer 實例。
構造 QScopedArrayPointer and stores the array of objects pointed to by p .
Swap this pointer with other .
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is
null
, behavior is undefined.
另請參閱 isNull ().
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is
null
, behavior is undefined.
另請參閱 isNull ().