このページでは

QJsonArray::const_iterator Class

class QJsonArray::const_iterator

QJsonArray::const_iterator クラスは、QJsonArray 用のSTLスタイルのconstイテレータを提供します。詳細...

QJsonArray::const_iterator の比較

カテゴリ比較可能な型
strongQJsonArray::const_iterator
strongQJsonArray::iterator.

パブリック型

パブリック関数

const_iterator()
const_iterator(const QJsonArray::iterator &other)
const_iterator(const QJsonArray::const_iterator &other)
const QJsonValueConstRef operator*() const
QJsonArray::const_iterator operator+(qsizetype j) const
QJsonArray::const_iterator &operator++()
QJsonArray::const_iterator operator++(int)
QJsonArray::const_iterator &operator+=(qsizetype j)
qsizetype operator-(QJsonArray::const_iterator other) const
QJsonArray::const_iterator operator-(qsizetype j) const
QJsonArray::const_iterator &operator--()
QJsonArray::const_iterator operator--(int)
QJsonArray::const_iterator &operator-=(qsizetype j)
const QJsonValueConstRef *operator->() const
QJsonValueConstRef operator[](qsizetype j) const
bool operator!=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator<(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator<=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator==(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator>(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator>=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

詳細な説明

QJsonArray::const_iterator QJsonArray を反復処理できます。反復処理中に ` ` を変更したい場合は、代わりに ` ` を使用してください。また、イテレータを介して ` ` を変更する必要がない限り、非 const の ` ` に対しても ` ` を使用するのが一般的なベストプラクティスです。const イテレータは処理速度がわずかに速く、コードの可読性も向上します。QJsonArray QJsonArray::iterator QJsonArray QJsonArray QJsonArray::const_iterator

QJsonArray::const_iterator のデフォルトコンストラクタは、初期化されていないイテレータを作成します。反復処理を開始する前に、QJsonArray::constBegin()、QJsonArray::constEnd()、またはQJsonArray::insert()などのQJsonArray 関数を使用して、イテレータを初期化する必要があります。

ほとんどのQJsonArray 関数は、イテレータではなく整数のインデックスを受け取ります。そのため、QJsonArray と組み合わせてイテレータを使用することはほとんどありません。STLスタイルのイテレータが意味を持つ唯一の場面は、generic algorithms の引数として使用する場合です。

同じ配列に対して複数のイテレータを使用することができます。ただし、QJsonArray に対して非 const の関数呼び出しを行うと、既存のすべてのイテレータが未定義の状態になることに注意してください。

QJsonArray::iteratorも参照してください 。

メンバ型のドキュメント

const_iterator::iterator_category

このイテレータがランダムアクセス・イテレータであることを示す、std::random_access_iterator_tagの同義語。

メンバ関数のドキュメント

const_iterator::const_iterator()

初期化されていないイテレータを作成します。

初期化されていないイテレータに対して、operator*() や operator++() などの関数を呼び出してはなりません。使用する前に、operator=() を使用して値を代入してください。

QJsonArray::constBegin() およびQJsonArray::constEnd()も参照してください 。

const_iterator::const_iterator(const QJsonArray::iterator &other)

other のコピーを作成します。

[constexpr noexcept default] const_iterator::const_iterator(const QJsonArray::const_iterator &other)

const_iterator のインスタンスをコピーして生成します。

const QJsonValueConstRef const_iterator::operator*() const

現在の項目を返します。

QJsonArray::const_iterator const_iterator::operator+(qsizetype j) const

このイテレータからj の位置だけ前方にある項目へのイテレータを返します。j が負の値の場合、イテレータは後方へ移動します。

operator-() およびoperator+=()も参照してください 。

QJsonArray::const_iterator &const_iterator::operator++()

プレフィックス演算子 `++ `(++it )は、イテレータを配列内の次の要素に進め、新しい現在の要素へのイテレータを返します。

QJsonArray::end() に対してこの関数を呼び出すと、未定義の結果となります。

operator--()も参照してください 。

QJsonArray::const_iterator const_iterator::operator++(int)

後置演算子++ (it++ )は、イテレータを配列内の次の要素に進め、直前の要素へのイテレータを返します。

これはオーバーロードされた関数です。

QJsonArray::const_iterator &const_iterator::operator+=(qsizetype j)

イテレータをj 個分進めます。j が負の場合、イテレータは逆方向に進みます。

operator-=() およびoperator+()も参照してください 。

qsizetype const_iterator::operator-(QJsonArray::const_iterator other) const

other が指す項目と、このイテレータが指す項目の間の項目の数を返します。

QJsonArray::const_iterator const_iterator::operator-(qsizetype j) const

このイテレータからj の位置だけ後ろにある項目へのイテレータを返します。j が負の値の場合、イテレータは前方へ移動します。

operator+() およびoperator-=()も参照してください 。

QJsonArray::const_iterator &const_iterator::operator--()

接頭辞演算子 `-- `(--it )は、直前の要素を現在の要素とし、新しい現在の要素へのイテレータを返します。

QJsonArray::begin() に対してこの関数を呼び出すと、未定義の結果となります。

operator++()も参照してください 。

QJsonArray::const_iterator const_iterator::operator--(int)

後置演算子「-- 」(it-- )は、直前の要素を現在の要素とし、それ以前に現在の要素だった要素へのイテレータを返します。

これはオーバーロードされた関数です。

QJsonArray::const_iterator &const_iterator::operator-=(qsizetype j)

イテレータをj 個分戻します。j が負の値の場合、イテレータは前進します。

operator+=() およびoperator-()も参照してください 。

const QJsonValueConstRef *const_iterator::operator->() const

現在の項目へのポインタを返します。

QJsonValueConstRef const_iterator::operator[](qsizetype j) const

このイテレータが指す項目(位置*this + j にある項目)から、オフセットj にある項目を返します。

この関数は、QJsonArray イテレータが C++ のポインタのように動作するようにするために提供されています。

operator+()も参照してください 。

関連する非メンバ関数

[noexcept] bool operator!=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs がrhs のイテレータとは異なる項目を指している場合はtrue を返し、そうでない場合はfalse を返します。

operator==()も参照してください 。

[noexcept] bool operator<(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs イテレータが指す項目が、rhs イテレータが指す項目よりも小さい場合、true を返します。

[noexcept] bool operator<=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs イテレータが指すアイテムが、rhs イテレータが指すアイテム以下である場合、true を返します。

[noexcept] bool operator==(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs がrhs のイテレータと同じ項目を指している場合はtrue を返し、そうでない場合はfalse を返します。

operator!=()も参照してください 。

[noexcept] bool operator>(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs イテレータが指す項目が、rhs イテレータが指す項目よりも大きい場合、true を返します。

[noexcept] bool operator>=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs イテレータが指す項目が、rhs イテレータが指す項目以上である場合、true を返します。

© 2026 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.