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 a const directory_entry.
  • typedef const directory_entry & reference β€” reference to a const directory_entry.
  • typedef directory_entry value_type β€” the value type is directory_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 an error_code to catch what went wrong.
  • directory_iterator (const path &__p, error_code &__ec) β€” path plus an error_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 your directory_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 and noexcept.
  • bool operator== (default_sentinel_t) const noexcept β€” comparison against default_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.
heads up bestie: these are not member symbols. they just live nearby.
  • directory_iterator begin (directory_iterator __iter) noexcept β€” enable range-based for using directory_iterator.
  • directory_iterator end (directory_iterator) noexcept β€” return a past-the-end directory_iterator.
  • recursive_directory_iterator begin (recursive_directory_iterator __iter) noexcept β€” enable range-based for using recursive_directory_iterator.
  • recursive_directory_iterator end (recursive_directory_iterator) noexcept β€” return a past-the-end recursive_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