QScopedArrayPointer Class

template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T>> class QScopedArrayPointer

QScopedArrayPointer クラスは、動的に割り当てられたオブジェクトの配列へのポインタを格納し、破棄時にそれを削除します。詳細...

ヘッダー #include <QScopedArrayPointer>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
継承: QScopedPointer

注意:このクラスの関数はすべてリエントラントです。

パブリック関数

QScopedArrayPointer()
QScopedArrayPointer(D *p)
T &operator[](qsizetype i)
const T &operator[](qsizetype i) const

詳細説明

QScopedArrayPointerはQScopedPointer 、delete[]演算子で指すオブジェクトを削除するのがデフォルトです。また、便利なように operator[] も備えているので、書くことができます:

void foo()
{
    QScopedArrayPointer<int> i(new int[10]);
    i[2] = 42;
    ...
    return; // our integer array is now deleted using delete[]
}

メンバ関数ドキュメント

QScopedArrayPointer::QScopedArrayPointer()

QScopedArrayPointer インスタンスを構築します。

[explicit] template <typename D, QScopedArrayPointer<T, Cleanup>::if_same_type<D> = true> QScopedArrayPointer::QScopedArrayPointer(D *p)

QScopedArrayPointer を構築し、p が指すオブジェクトの配列を格納します。

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

スコープされたポインタのオブジェクト配列のエントリi へのアクセスを提供する。

含まれるポインタがnullptr の場合、動作は未定義です。

注意: Qt 6.5 より前のバージョンでは、iqsizetype ではなくint 型でした。

isNull()も参照してください

const T &QScopedArrayPointer::operator[](qsizetype i) const

スコープされたポインタのオブジェクト配列のエントリi へのアクセスを提供する。

含まれるポインタがnullptr の場合、動作は未定義です。

注意: Qt 6.5 より前のバージョンでは、iqsizetype ではなくint 型でした。

isNull()も参照してください

© 2025 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 the GNU 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.