STD::FILESYSTEM::DIRECTORY_ITERATOR(3)
π std::filesystem::directory_iterator π
okay bestie, welcome to the <filesystem> manual β specifically the page for std::filesystem::directory_iterator, a libstdc++ Library Functions Manual situation. this one is the iterator type for traversing the entries in a single directory, and she is lowkey iconic. no cap.
β¨ NAME β¨
std::filesystem::directory_iterator β iterator type for traversing the entries in a single directory. that's it, that's the whole vibe. one directory, one iterator, slay. π
πΈ SYNOPSIS πΈ
#include <filesystem>
π¦ Public Types
typedef ptrdiff_t difference_typeβ the difference type, standard-issue.typedef input_iterator_tag iterator_categoryβ she's an input iterator, periodt.typedef const directory_entry * pointerβ pointer to aconst directory_entry.typedef const directory_entry & referenceβ reference to aconst directory_entry.typedef directory_entry value_typeβ the value type isdirectory_entry, obviously.
π Public Member Functions
directory_iterator (const directory_iterator &__rhs)=defaultβ copy constructor, defaulted, no notes.directory_iterator (const path &__p)β construct one for the path__p.directory_iterator (const path &__p, directory_options __options)β same but you also get to pass__options.directory_iterator (const path &__p, directory_options __options, error_code &__ec)β path, options, and anerror_codeto catch what went wrong.directory_iterator (const path &__p, error_code &__ec)β path plus anerror_code.directory_iterator (directory_iterator &&__rhs) noexcept=defaultβ move constructor, defaulted,noexcept, she moves fast fr fr.directory_iterator & increment (error_code &__ec)β advance it, reporting into__ec.const directory_entry & operator* () const noexceptβ dereference, get yourdirectory_entry.noexcept, we love that.directory_iterator & operator++ ()β pre-increment. step to the next entry bestie.__directory_iterator_proxy operator++ (int)β post-increment, returns the mysterious__directory_iterator_proxy.const directory_entry * operator-> () const noexceptβ arrow operator,noexcept, gives you the pointer.directory_iterator & operator= (const directory_iterator &__rhs)=defaultβ copy assignment, defaulted.directory_iterator & operator= (directory_iterator &&__rhs) noexcept=defaultβ move assignment, defaulted andnoexcept.bool operator== (default_sentinel_t) const noexceptβ comparison againstdefault_sentinel_t,noexcept. this is how you know you hit the end. π
π Friends
bool operator== (const directory_iterator &__lhs, const directory_iterator &__rhs) noexceptβ comparing two iterators,noexcept.class recursive_directory_iteratorβ she's a friend of the house.
π Related Symbols
heads up bestie: these are not member symbols. they just live nearby.
directory_iterator begin (directory_iterator __iter) noexceptβ enable range-basedforusingdirectory_iterator.directory_iterator end (directory_iterator) noexceptβ return a past-the-enddirectory_iterator.recursive_directory_iterator begin (recursive_directory_iterator __iter) noexceptβ enable range-basedforusingrecursive_directory_iterator.recursive_directory_iterator end (recursive_directory_iterator) noexceptβ return a past-the-endrecursive_directory_iterator.
π§ Detailed Description
Iterator type for traversing the entries in a single directory. she does one job and she does it gorgeously. π
Since: C++17 β yes she's been here since C++17, an elder stateswoman, a queen. π
π Author
Generated automatically by Doxygen for libstdc++ from the source code. not me writing a whole personality for an auto-generated doc π
so yeah, that's the whole page. every type, every constructor, every operator, every friend, every related symbol β all accounted for. ate and left no crumbs β¨
sign-off time: this was the libstdc++ manual page for std::filesystem::directory_iterator, brought to you by libstdc++ (and Doxygen, who technically wrote all of it). mwah π π«Ά
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms