std::experimental::filesystem::path:: parent_path
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
| Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
| Path decomposition | ||||
| Non-member functions | ||||
|
path parent_path
(
)
const
;
|
(Filesystem TS) | |
Gibt den Pfad zum übergeordneten Verzeichnis zurück. Gibt einen leeren Pfad zurück, wenn empty ( ) oder wenn nur ein einzelnes Element im Pfad vorhanden ist ( begin ( ) == -- end ( ) ).
Der resultierende Pfad wird durch Anhängen aller Elemente in einem Bereich
[
begin
(
)
,
--
end
(
)
)
an einen leeren Pfad konstruiert.
Inhaltsverzeichnis |
Parameter
(keine)
Rückgabewert
Der Pfad zum übergeordneten Verzeichnis.
Exceptions
Kann implementierungsdefinierte Ausnahmen auslösen.
Beispiel
#include <experimental/filesystem> #include <iostream> namespace fs = std::experimental::filesystem; int main() { for (fs::path p : {"/var/tmp/example.txt", "/", "/var/tmp/."}) std::cout << "The parent path of " << p << " is " << p.parent_path() << '\n'; }
Mögliche Ausgabe:
The parent path of "/var/tmp/example.txt" is "/var/tmp" The parent path of "/" is "" The parent path of "/var/tmp/." is "/var/tmp"
Siehe auch
| Dieser Abschnitt ist unvollständig |