std::filesyste...ectory_iterator(3cxx)
πΈ NAME
std::filesystem::directory_iterator β bestie, it's the iterator type for traversing the entries in a single directory. That's it, that's the whole vibe. One directory. You go through it, entry by entry. Iconic. π
β¨ SYNOPSIS
#include <fs_dir.h>
π Public Types
typedef ptrdiff_t difference_typeβ the difference type, for when you gotta measure the gap between two of these bad boys.typedef input_iterator_tag iterator_categoryβ it's an input iterator, so it's giving one-pass, read-only, don't-get-greedy energy. No random access here, sorry bestie.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. Copy away, queen.directory_iterator (const path &__p)β construct from apath. Just the path.directory_iterator (const path &__p, directory_options __options)β construct from apathanddirectory_options. Fancy.directory_iterator (const path &__p, directory_options __options, error_code &__ec)β path, options, and anerror_codeyou can check instead of getting jumped by an exception.directory_iterator (const path &__p, error_code &__ec)β path plus anerror_code. Same deal, no options.directory_iterator (directory_iterator &&__rhs) noexcept=defaultβ move constructor, defaulted,noexcept. She moves. Effortlessly. β¨directory_iterator & increment (error_code &__ec)β advance it, and report any problem through__ec.const directory_entry & operator* () const noexceptβ dereference, get thedirectory_entry.noexcept, so no surprises.directory_iterator & operator++ ()β pre-increment. Step to the next entry.__directory_iterator_proxy operator++ (int)β post-increment, and it returns a__directory_iterator_proxy. (iykyk)const directory_entry * operator-> () const noexceptβ arrow operator, reach into the entry. Alsonoexcept.directory_iterator & operator= (const directory_iterator &__rhs)=defaultβ copy assignment, defaulted.directory_iterator & operator= (directory_iterator &&__rhs) noexcept=defaultβ move assignment, defaulted,noexcept. Periodt.
π Friends
bool operator!= (const directory_iterator &__lhs, const directory_iterator &__rhs) noexceptβ not-equal comparison. This is literally how you know you've hit the end, bestie.bool operator== (const directory_iterator &__lhs, const directory_iterator &__rhs) noexceptβ equals comparison. Two iterators, same energy?class recursive_directory_iteratorβ a whole friend class! It gets access. It's in the group chat.
π Related Symbols
Heads up: these are not member symbols. They're just here, hanging out, being useful.
directory_iterator begin (directory_iterator __iter) noexceptβ Enable range-basedforusingdirectory_iterator. So you can write the cutefor (auto& e : dir)thing. Slay.directory_iterator end (directory_iterator) noexceptβ Return a past-the-enddirectory_iterator. The finish line. π
π Detailed Description
Iterator type for traversing the entries in a single directory.
π Author
Generated automatically by Doxygen for libstdc++ from the source code. (The man page itself is from the 3cxx manual section, and it's carrying the libstdc++ source and version tag on its little footer.) So technically nobody wrote this by hand β the machine did it, and honestly? She ate. π«Άβ¨ Thanks for reading, bestie, now go iterate responsibly. π
π¦ where this page comes from
- ubuntu noble: libstdc++-11-doc 11.4.0-9ubuntu1
- ubuntu noble: libstdc++-11-doc 11.5.0-1ubuntu1~24.04.1
- ubuntu questing: libstdc++-11-doc 11.5.0-7ubuntu1
- ubuntu questing: libstdc++-11-doc 11.5.0-7ubuntu1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms