const_iterator Class

class QDirListing::const_iterator

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

パブリック型

パブリック関数

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

詳細な説明

QDirListing::cbegin() が返すイテレータ型。

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

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

QDirListingQDirListing::sentinel 、およびQDirListing::DirEntryも参照してください

メンバ型のドキュメント

[alias] const_iterator::pointer

const QDirListing::DirEntry * の型定義。

[alias] const_iterator::reference

const QDirListing::DirEntry & の typedef 。

メンバ関数ドキュメント

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 つまり、移動のみ、前進のみ、シングルパスのイテレータであり、ランダムアクセスは許可されません。

std::input_iterator をモデル化したオブジェクトに対する post-increment の戻り値は、部分的に形成されたもの(前に進められたイテレータのコピー)です。このようなオブジェクトに対する有効な操作は、破棄と新しいイテレータの割り当てだけです。したがって、ポストインクリメント演算子はイテレータを進め、void を返します。

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

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

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