QScopedArrayPointer Class
The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction. 更多...
头文件: | #include <QScopedArrayPointer> |
qmake: | QT += core |
开始支持版本: | Qt 4.6 |
基类: | QScopedPointer |
Note: All functions in this class are reentrant.
公有函数
QScopedArrayPointer() | |
void | swap(QScopedArrayPointer &other) |
T & | operator[](int i) |
const T & | operator[](int i) const |
- 9 个公有函数继承自 QScopedPointer
详细描述
The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction.
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[] }
成员函数
QScopedArrayPointer::QScopedArrayPointer()
Constructs a QScopedArrayPointer instance.
void QScopedArrayPointer::swap(QScopedArrayPointer &other)
T &QScopedArrayPointer::operator[](int i)
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is null
, behavior is undefined.
参见 isNull().
const T &QScopedArrayPointer::operator[](int i) const
Provides access to entry i of the scoped pointer's array of objects.
If the contained pointer is null
, behavior is undefined.
参见 isNull().