std::filesy...is_relative(3)
π 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 πΈ
trueif the path is absolute,falseotherwise.falseif the path is absolute,trueotherwise.
π₯ 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
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms