This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
filesystem::path::filename()
Section: 31.12.6.5.9 [fs.path.decompose] Status: New Submitter: Jonathan Wakely Opened: 2018-04-06 Last modified: 2020-09-06
Priority: 3
View all other issues in [fs.path.decompose].
View all issues with New status.
Discussion:
The example in [fs.path.decompose] p7 includes:
path("//host").filename(); // yields ""
This result isn't guaranteed, it depends whether the implementation interprets "//host"
as a root-name
or as a root-directory (with a redundant directory-separator) followed by the filename "host"
.
Previous resolution [SUPERSEDED]:
This wording is relative to N4727.
Edit 31.12.6.5.9 [fs.path.decompose] as indicated:
path filename() const;-6- Returns:
[Example:relative_path().empty() ? path() : *--end()
.path("/foo/bar.txt").filename(); // yields "bar.txt" path("/foo/bar").filename(); // yields "bar" path("/foo/bar/").filename(); // yields "" path("/").filename(); // yields "" path("//host").filename(); // yields "" or "host" path(".").filename(); // yields "." path("..").filename(); // yields ".."— end example]
[2018-04-10, Jonathan comments and provides revised wording]
Based on the reflector discussion I'd like to change the P/R to Billy's suggestion of simply removing that line from the example.
[2018-06-18 after reflector discussion]
Priority set to 3
Proposed resolution:
This wording is relative to N4741.
Edit 31.12.6.5.9 [fs.path.decompose] as indicated:
path filename() const;-6- Returns:
[Example:relative_path().empty() ? path() : *--end()
.path("/foo/bar.txt").filename(); // yields "bar.txt" path("/foo/bar").filename(); // yields "bar" path("/foo/bar/").filename(); // yields "" path("/").filename(); // yields ""path("//host").filename(); // yields ""path(".").filename(); // yields "." path("..").filename(); // yields ".."— end example]