This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
Section: 18.104.22.168.11 [fs.path.gen] Status: WP Submitter: Billy O'Neal III Opened: 2018-02-23 Last modified: 2019-11-19
View all other issues in [fs.path.gen].
View all issues with WP status.
path::lexically_relative constructs the resulting path with operator/=. If any of the filename elements from *this are themselves acceptable root-names, operator/= will destroy any previous value, and take that root_name(). For example:
On a POSIX implementation, this would return path("../b:"), but on a Windows implementation, the "b:" element is interpreted as a root-name, and clobbers the entire result path, giving path("b:"). We should detect this problematic condition and fail (by returning path()).
[2019-01-20 Reflector prioritization]
Set Priority to 2
[2019 Cologne Wednesday night]
Status to Ready
This wording is relative to N4727.
Change 22.214.171.124.11 [fs.path.gen] as indicated:
path lexically_relative(const path& base) const;
-3- […]-4- Effects: If root_name() != base.root_name() is true or is_absolute() != base.is_absolute() is true or !has_root_directory() && base.has_root_directory() is true , returns path(). Determines the first mismatched element of *this and base as if by:auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
(4.1) — if a == end() and b == base.end(), returns path("."); otherwise
(4.2) — let n be the number of filename elements in [b, base.end()) that are not dot or dot-dot minus the number that are dot-dot. If n < 0, returns path(); otherwise
(4.3) — returns an object of class path that is default-constructed, followed by
(4.3.1) — application of operator/=(path("..")) n times, and then
(4.3.2) — application of operator/= for each element in [a, end()).