std::experi...egular_file(3)

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

Hey bestie πŸ’– you just opened the std::experi...egular_file(3) page from the C++ Standard Libary manual β€” and yes, we’re gonna get into it ✨

✨ NAME ✨

std::experimental::filesystem::is_regular_file β€” std::experimental::filesystem::is_regular_file (yes, the description is literally the name again, and honestly? iconic 😭).

🌸 Synopsis 🌸

Defined in header <experimental/filesystem>
bool is_regular_file( file_status s );                 (1)
(filesystem TS)
bool is_regular_file( const path& p );                 (2)
(filesystem TS)
bool is_regular_file( const path& p, error_code& ec ); (3)
(filesystem TS)

The vibe check: it checks if the given file status or path corresponds to a regular file πŸ¦‹

  • 1) Equivalent to s.type() == file_type::regular.
  • 2) Equivalent to is_regular_file(status(p)).
  • 3) Equivalent to is_regular_file(status(p, ec)). Returns false and sets ec to an appropriate error code if an error occurs. Otherwise, ec is cleared with a call to ec.clear().
This section is incomplete Reason: the specification says that (2) throws filesystem_error if status(p) would throw filesystem_error. This is different from the rest of is_**_file functions. Is that correct and if yes, what's the rationale?

πŸŽ€ Parameters πŸŽ€

  • s β€” file status to check
  • p β€” path to examine
  • ec β€” error code to store the error status to

πŸ’– Return value πŸ’–

true if the given path or file status corresponds to a regular link, false otherwise ✨

🚨 Exceptions 🚨

  • 1,3) β€” noexcept specification: noexcept
  • 2) β€” Throws filesystem_error if an error occurs. The error is constructed with p as an argument. The error code is set to an appropriate error code for the error that caused the failure.

πŸ‘€ See also πŸ‘€

This section is incomplete

πŸ—‚οΈ Categories πŸ—‚οΈ

  • Noindexed pages
  • Todo with reason
  • unconditionally noexcept
  • Todo without reason

πŸ™ˆ Hidden categories πŸ™ˆ

  • Pages with unreviewed unconditional noexcept template
  • Pages with unreviewed noexcept template

mwah πŸ’‹ β€” sourced from http://cppreference.com, dated 2024.06.10 🫢

πŸ“¦ where this page comes from