このページでは

QDirListing::const_iterator Class

class QDirListing::const_iterator

このクラスは Qt 6.8 で導入されました。

パブリック型

パブリック関数

const_iterator()
const_iterator(QDirListing::const_iterator &&)
QDirListing::const_iterator::reference operator*() const
QDirListing::const_iterator &operator++()
void operator++(int)
QDirListing::const_iterator::pointer operator->() const
QDirListing::const_iterator &operator=(QDirListing::const_iterator &&)

詳細な説明

QDirListing::cbegin() によって返されるイテレータ型。

  • これは、順方向のみのシングルパス・イテレータです(ディレクトリエントリを逆順に反復処理することはできません)。
  • コピーすることはできず、std::move()d のみが使用可能です。
  • std::input_iterator をモデルとするオブジェクトに対するポストインクリメントの戻り値は、部分的に形成されたもの(それ以降に前進したイテレータのコピー)であり、そのようなオブジェクトに対して有効な操作は、破棄と新しいイテレータの代入のみです。したがって、ポストインクリメント演算子はイテレータを前進させ、void を返します。
  • ランダムアクセスは許可されません
  • 範囲指定の for ループで使用可能。または、ランダムアクセスイテレータを必要としない C++20 の std::ranges アルゴリズムと併用可能
  • 有効なイテレータを間接参照すると、const DirEntry &
  • (c)end() は、反復の終了を示すQDirListing::sentinel を返します。end() と等しいイテレータを間接参照すると、未定義の挙動となります

注: 「従来の」STLアルゴリズムは iterator/sentinelをサポートしていないため、QDirListing を使用するにはC++20のstd::rangesアルゴリズム、あるいはC++17で範囲ベースのアルゴリズムを提供するサードパーティ製ライブラリを使用する必要があります。

関連項目: QDirListing 、QDirListing::sentinel 、およびQDirListing::DirEntry 。

メンバ型のドキュメント

[alias] const_iterator::pointer

const QDirListing::DirEntry * の typedef です。

[alias] const_iterator::reference

const QDirListing::DirEntry & の typedef です。

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

[constexpr noexcept default] const_iterator::const_iterator()

const_iterator のインスタンスをデフォルトコンストラクタで生成します。

[constexpr noexcept default] const_iterator::const_iterator(QDirListing::const_iterator &&)

const_iterator のインスタンスをムーブコンストラクトで生成します。

QDirListing::const_iterator::reference const_iterator::operator*() const

このイテレータが指すディレクトリエントリのconst QDirListing::DirEntry & を返します。

QDirListing::const_iterator &const_iterator::operator++()

前増分演算子。イテレータを進め、その参照を返します。

void const_iterator::operator++(int)

後増分演算子。

QDirListing::const_iterator C++20のstd::input_iteratorをモデル化しており、つまり、ランダムアクセスを許可しない、移動専用、前方専用、シングルパスなイテレータである。

std::input_iterator をモデル化するオブジェクトに対するポストインクリメントの戻り値は、部分的に形成された状態(その時点で既に進められたイテレータのコピー)である。このようなオブジェクトに対して有効な操作は、破棄と新しいイテレータの代入のみである。したがって、ポストインクリメント演算子はイテレータを進め、void を返す。

QDirListing::const_iterator::pointer const_iterator::operator->() const

このイテレータが指すディレクトリエントリへのconst QDirListing::DirEntry * を返します。

[constexpr noexcept default] QDirListing::const_iterator &const_iterator::operator=(QDirListing::const_iterator &&)

other をこのconst_iterator インスタンスに割り当てます。

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