tmp/tmpenu0vhds/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### `path` generation <a id="fs.path.gen">[[fs.path.gen]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
path lexically_normal() const;
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Returns:* A path whose pathname in the generic format is the normal
|
| 8 |
+
form ([[fs.def.normal.form]]) of the pathname in the generic format of
|
| 9 |
+
`*this`.
|
| 10 |
+
|
| 11 |
+
[*Example 10*:
|
| 12 |
+
|
| 13 |
+
``` cpp
|
| 14 |
+
assert(path("foo/./bar/..").lexically_normal() == "foo/");
|
| 15 |
+
assert(path("foo/.///bar/../").lexically_normal() == "foo/");
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
The above assertions will succeed. On Windows, the returned path’s
|
| 19 |
+
*directory-separator* characters will be backslashes rather than
|
| 20 |
+
slashes, but that does not affect `path` equality.
|
| 21 |
+
|
| 22 |
+
— *end example*]
|
| 23 |
+
|
| 24 |
+
``` cpp
|
| 25 |
+
path lexically_relative(const path& base) const;
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
*Returns:* `*this` made relative to `base`. Does not
|
| 29 |
+
resolve ([[fs.def.pathres]]) symlinks. Does not first
|
| 30 |
+
normalize ([[fs.def.normal.form]]) `*this` or `base`.
|
| 31 |
+
|
| 32 |
+
*Effects:* If `root_name() != base.root_name()` is `true` or
|
| 33 |
+
`is_absolute() != base.is_absolute()` is `true` or
|
| 34 |
+
`!has_root_directory() && base.has_root_directory()` is `true`, returns
|
| 35 |
+
`path()`. Determines the first mismatched element of `*this` and `base`
|
| 36 |
+
as if by:
|
| 37 |
+
|
| 38 |
+
``` cpp
|
| 39 |
+
auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Then,
|
| 43 |
+
|
| 44 |
+
- if `a == end()` and `b == base.end()`, returns `path(".")`; otherwise
|
| 45 |
+
- let `n` be the number of *filename* elements in \[`b`, `base.end()`)
|
| 46 |
+
that are not *dot* or *dot-dot* minus the number that are *dot-dot*.
|
| 47 |
+
If `n<0,` returns `path()`; otherwise
|
| 48 |
+
- returns an object of class `path` that is default-constructed,
|
| 49 |
+
followed by
|
| 50 |
+
- application of `operator/=(path(".."))` `n` times, and then
|
| 51 |
+
- application of `operator/=` for each element in \[`a`, `end()`).
|
| 52 |
+
|
| 53 |
+
[*Example 11*:
|
| 54 |
+
|
| 55 |
+
``` cpp
|
| 56 |
+
assert(path("/a/d").lexically_relative("/a/b/c") == "../../d");
|
| 57 |
+
assert(path("/a/b/c").lexically_relative("/a/d") == "../b/c");
|
| 58 |
+
assert(path("a/b/c").lexically_relative("a") == "b/c");
|
| 59 |
+
assert(path("a/b/c").lexically_relative("a/b/c/x/y") == "../..");
|
| 60 |
+
assert(path("a/b/c").lexically_relative("a/b/c") == ".");
|
| 61 |
+
assert(path("a/b").lexically_relative("c/d") == "../../a/b");
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
The above assertions will succeed. On Windows, the returned path’s
|
| 65 |
+
*directory-separator* characters will be backslashes rather than
|
| 66 |
+
slashes, but that does not affect `path` equality.
|
| 67 |
+
|
| 68 |
+
— *end example*]
|
| 69 |
+
|
| 70 |
+
[*Note 6*: If symlink following semantics are desired, use the
|
| 71 |
+
operational function `relative()`. — *end note*]
|
| 72 |
+
|
| 73 |
+
[*Note 7*: If normalization ([[fs.def.normal.form]]) is needed to
|
| 74 |
+
ensure consistent matching of elements, apply `lexically_normal()` to
|
| 75 |
+
`*this`, `base`, or both. — *end note*]
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
path lexically_proximate(const path& base) const;
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
*Returns:* If the value of `lexically_relative(base)` is not an empty
|
| 82 |
+
path, return it. Otherwise return `*this`.
|
| 83 |
+
|
| 84 |
+
[*Note 8*: If symlink following semantics are desired, use the
|
| 85 |
+
operational function `proximate()`. — *end note*]
|
| 86 |
+
|
| 87 |
+
[*Note 9*: If normalization ([[fs.def.normal.form]]) is needed to
|
| 88 |
+
ensure consistent matching of elements, apply `lexically_normal()` to
|
| 89 |
+
`*this`, `base`, or both. — *end note*]
|
| 90 |
+
|