std::filesystem::path::is_absolute,is_relative
From cppreference.com
< cpp | filesystem | path
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
std::filesystem::path
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
bool is_absolute() const;
(1)
(since C++17)
bool is_relative() const;
(2)
(since C++17)
Checks whether the path is 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, false otherwise; the second version the other way round.
[edit] Parameters
(none)
[edit] Return value
1) true if the path is absolute, false otherwise.
2) false if the path is absolute, true otherwise.
[edit] Exceptions
May throw implementation-defined exceptions.
[edit] Notes
The path "/" is absolute on a POSIX OS, but is relative on Windows.