std::filesy...ectory_entry(3)

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

πŸ’… NAME πŸ’…

okay bestie, welcome to the manual page for std::filesystem::directory_entry::directory_entry β€” yes, the constructor page, and the manual name up top is literally std::filesy...ectory_entry(3) (that truncation is giving "my group chat name hit the character limit" 😭). It's from the C++ Standard Libary β€” their spelling, not mine β€” and the NAME line is a whole echo:

std::filesystem::directory_entry::directory_entry -
std::filesystem::directory_entry::directory_entry

✨ Synopsis ✨

okay so here's the overload lineup, copied exactly because we do not mess with code, periodt:

          directory_entry() noexcept = default;
       (1) (since C++17)
          directory_entry( const directory_entry& ) = default;
       (2) (since C++17)
          directory_entry( directory_entry&& ) noexcept = default;
       (3) (since C++17)
          explicit directory_entry( const std::filesystem::path& p );
       (4) (since C++17)
          directory_entry( const std::filesystem::path& p, std::error_code&
       (5) (since C++17)
          ec );

This whole thing constructs a new directory_entry object. The overloads break down like this:

  1. 1) Default constructor. It just does the default thing. πŸ’…
  2. 2) Defaulted copy constructor. Copy vibe, defaulted.
  3. 3) Defaulted move constructor. Move vibe, and it's noexcept.
  4. 4,5) These initialize the directory entry with path p and call refresh to update the cached attributes. If an error occurs, the non-throwing overload leaves the directory_entry holding a default-constructed path.

πŸŽ€ Parameters πŸŽ€

  • p β€” path to the filesystem object to which the directory entry will refer.
  • ec β€” out-parameter for error reporting in the non-throwing overload.

πŸ’€ Exceptions πŸ’€

Any overload not marked noexcept may throw std::bad_alloc if memory allocation fails. That's the baseline; even icons have bad days.

  • 1-4) β€” Throws std::filesystem::filesystem_error on underlying OS API errors, constructed with p as the first path argument and the OS error code as the error code argument.
  • 5) β€” Sets a std::error_code& parameter to the OS API error code if an OS API call fails, and executes ec.clear() if no errors occur.

πŸ¦‹ Example πŸ¦‹

This section is incomplete Reason: no example

not me finding an empty example section 😭 it's giving "left on read."

πŸ‘‘ Category: πŸ‘‘

  • Todo no example

That's the whole page, bestie. Source: http://cppreference.com, version/date: 2024.06.10, manual name: std::filesy...ectory_entry(3). Periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from