Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QScopedArrayPointer Class

TheQScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction.More...

Header:#include <QScopedArrayPointer>
Since: Qt 4.6
Inherits:QScopedPointer<T, Cleanup>

Note: All functions in this class arereentrant.

Public Functions

QScopedArrayPointer()
QScopedArrayPointer(D * p, QtPrivate::QScopedArrayEnsureSameType<T, D>::Type = 0)
T &operator[](int i)
const T &operator[](int i) const

Detailed Description

TheQScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction.

AQScopedArrayPointer is aQScopedPointer 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(newint[10]);    i[2]=42;...return;// our integer array is now deleted using delete[]}

Member Function Documentation

QScopedArrayPointer::QScopedArrayPointer()

Constructs aQScopedArrayPointer instance.

QScopedArrayPointer::QScopedArrayPointer(D * p,QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0)

T & QScopedArrayPointer::operator[](int i)

Provides access to entryi of the scoped pointer's array of objects.

If the contained pointer isnull, behavior is undefined.

See alsoisNull().

constT & QScopedArrayPointer::operator[](int i) const

Provides access to entryi of the scoped pointer's array of objects.

If the contained pointer isnull, behavior is undefined.

See alsoisNull().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp