このページでは

QIterable Class

template <typename Container> class QIterable

QIterable は、QMetaSequence::Iterable およびQMetaAssociation::Iterable の基底クラスとなるテンプレートクラスです。詳細...

ヘッダー: #include <QIterable>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
以下のように: Qt 6.0
継承元:

QAssociativeIterable およびQSequentialIterable

パブリック関数

bool canForwardIterate() const
bool canInputIterate() const
bool canRandomAccessIterate() const
bool canReverseIterate() const
void clear()
QConstIterator<Container> constBegin() const
QConstIterator<Container> constEnd() const
QIterator<Container> mutableBegin()
QIterator<Container> mutableEnd()
qsizetype size() const

詳細な説明

QIterable<Container> は、QVariant を通じてコンテナを反復処理するための共通インターフェースを提供します。ここで、Container は、コンテナの反復処理機能を定義するメタ型記述子(QMetaSequence またはQMetaAssociation のいずれか)です。

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

bool QIterable::canForwardIterate() const

コンテナを順方向に反復処理できるかどうかを返します。これは、コンテナの iterator および const_iterator が持つ std::forward_iterator_tag イテレータ特性を反映したものです。

bool QIterable::canInputIterate() const

コンテナに入力イテレータがあるかどうかを返します。これは、コンテナのイテレータおよびconst_iteratorに対するstd::input_iterator_tagイテレータ特性に対応しています。

bool QIterable::canRandomAccessIterate() const

イテレータを使用して複数の値を効率的にスキップできるかどうかを返します。これは、コンテナのイテレータおよび const_iterator における std::random_access_iterator_tag イテレータ・トレイトに対応しています。

bool QIterable::canReverseIterate() const

コンテナを逆順に反復処理できるかどうかを返します。これは、コンテナの const_iterator が持つ std::bidirectional_iterator_tag イテレータ特性を表します。

void QIterable::clear()

コンテナをクリアします。

QConstIterator<Container> QIterable::constBegin() const

コンテナの先頭を示すQConstIterator を返します。これはSTL形式の反復処理で使用できます。

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

QConstIterator<Container> QIterable::constEnd() const

コンテナの末尾を指す Qterable::QConstIterator を返します。これは STL スタイルの反復処理で使用できます。

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

QIterator<Container> QIterable::mutableBegin()

コンテナの先頭を示すQIterator を返します。これはSTL形式の反復処理で使用できます。

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

QIterator<Container> QIterable::mutableEnd()

コンテナの末尾を指す QMetaSequence::Iterable::iterator を返します。これは STL スタイルの反復処理で使用できます。

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

qsizetype QIterable::size() const

コンテナ内の値の数を返します。

注: 基となるコンテナがサイズを照会するためのネイティブな手段を提供していない場合 、このメソッドはイテレータを使用してアクセスを合成します。この動作は非推奨となっており、将来のQtのバージョンで削除される予定です。

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