std::filesy...is_relative(3)

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

πŸ’– NAME πŸ’–

okay so this page is std::filesy...is_relative(3), straight out of the C++ Standard Libary (yes that's literally how it's spelled in the header, and we are keeping it, no notes), and the NAME section says std::filesystem::path::is_absolute,is_relative β€” and then says std::filesystem::path::is_absolute,is_relative again, because repetition is a vibe, periodt.


✨ Synopsis ✨

bool is_absolute() const; (1) (since C++17)
bool is_relative() const; (2) (since C++17)

So basically these two functions do a vibe check on your path: is it absolute or relative? πŸ¦‹

An absolute path is a path that unambiguously identifies the location of a file without reference to an additional starting location. The first version returns true if the path, in native format, is absolute, and false otherwise. The second version is literally the other way round. That's it. That's the whole serve. πŸ’…


πŸŽ€ Parameters πŸŽ€

  • (none) β€” yeah bestie, no arguments, she takes nothing and still gives main character energy.

🌸 Return value 🌸

  1. true if the path is absolute, false otherwise.
  2. false if the path is absolute, true otherwise.

πŸ”₯ Exceptions πŸ”₯

May throw implementation-defined exceptions.

⚠️ translation: the implementation gets to decide which exceptions show up here, so don't come for me if your compiler's version of events is different. πŸ™ˆ

🌈 Notes 🌈

The path / is absolute on a POSIX OS, but is relative on Windows. Yes, literally the same tiny slash, different personality depending on the OS. Iconic cross-platform behavior, honestly. πŸ’€


⭐ See also ⭐

  • absolute β€” composes an absolute path (C++17) (function)

okay that's the whole page, bestie, go forth and let your paths know whether they're absolute or relative 🫢

source/version and date tea: this was living at http://cppreference.com on 2024.06.10 β€” mwah, bye πŸ’œ

πŸ“¦ where this page comes from