std::filesy...::operator*,(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::filesy...::operator*,(3) πŸ’…

okay bestie, this is a C++ Standard Libary manual page, section (3). Yes, the manual name is right there near the top, and yes, we're about to talk about std::filesystem::recursive_directory_iterator's operator* and operator->. It's giving filesystem main character energy. πŸ¦‹

🌸 NAME 🌸

Literally these lines, dash and all:

std::filesystem::recursive_directory_iterator::operator*, -
std::filesystem::recursive_directory_iterator::operator*,

So yeah β€” this page is the operator* / operator-> moment for std::filesystem::recursive_directory_iterator. Periodt. πŸ’…

✨ Synopsis ✨

const std::filesystem::directory_entry& operator*() const;  (1)
(since C++17)
const std::filesystem::directory_entry* operator->() const; (2)
(since C++17)

okay so line (1) is the operator* signature and line (2) is the operator-> signature, both marked (since C++17).

This accesses the pointed-to directory_entry β€” that's the whole point, bestie.

⚠️ The result of operator* or operator-> on the end iterator is undefined behavior. Not a drill. Not cute. Do not collect $200. 😭

🌈 Parameters 🌈

(none) β€” literally no parameters. Slay. ✨

πŸŽ€ Return value πŸŽ€

  1. Value of the directory_entry referred to by this iterator.
  2. Pointer to the directory_entry referred to by this iterator.

So (1) gives you the value, (2) gives you the pointer. Simple, clean, iconic. 🫢

πŸ”₯ Exceptions πŸ”₯

May throw implementation-defined exceptions. So the implementation gets to choose the drama, and honestly? Rude. 😭

πŸ‘‘ See also πŸ‘‘

  • operator* β€” accesses the pointed-to entry
  • operator-> β€” public member function of std::filesystem::directory_iterator

xoxo, bestie πŸ’– β€” that was std::filesy...::operator*,(3), source: http://cppreference.com, version/date: 2024.06.10. mwah πŸ’‹

πŸ“¦ where this page comes from