From Jason Turner

[fs.path.member]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwe4uds37/{from.md → to.md} +127 -114
tmp/tmpwe4uds37/{from.md → to.md} RENAMED
@@ -1,16 +1,14 @@
1
- #### `path` members <a id="fs.path.member">[[fs.path.member]]</a>
2
 
3
- ##### `path` constructors <a id="fs.path.construct">[[fs.path.construct]]</a>
4
 
5
  ``` cpp
6
  path() noexcept;
7
  ```
8
 
9
- *Effects:* Constructs an object of class `path`.
10
-
11
- *Postconditions:* `empty() == true`.
12
 
13
  ``` cpp
14
  path(const path& p);
15
  path(path&& p) noexcept;
16
  ```
@@ -23,49 +21,48 @@ state.
23
  ``` cpp
24
  path(string_type&& source, format fmt = auto_format);
25
  ```
26
 
27
  *Effects:* Constructs an object of class `path` for which the pathname
28
- in the detected-format of `source` has the original value of
29
- `source` ([[fs.path.fmt.cvt]]), converting format if
30
- required ([[fs.path.fmt.cvt]]). `source` is left in a valid but
31
- unspecified state.
32
 
33
  ``` cpp
34
  template<class Source>
35
  path(const Source& source, format fmt = auto_format);
36
  template<class InputIterator>
37
  path(InputIterator first, InputIterator last, format fmt = auto_format);
38
  ```
39
 
40
- *Effects:* Let `s` be the effective range of `source` ([[fs.path.req]])
41
- or the range \[`first`, `last`), with the encoding converted if
42
- required ([[fs.path.cvt]]). Finds the detected-format of
43
- `s` ([[fs.path.fmt.cvt]]) and constructs an object of class `path` for
44
- which the pathname in that format is `s`.
45
 
46
  ``` cpp
47
  template<class Source>
48
  path(const Source& source, const locale& loc, format fmt = auto_format);
49
  template<class InputIterator>
50
  path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format);
51
  ```
52
 
53
- *Requires:* The value type of `Source` and `InputIterator` is `char`.
54
 
55
  *Effects:* Let `s` be the effective range of `source` or the range
56
  \[`first`, `last`), after converting the encoding as follows:
57
 
58
  - If `value_type` is `wchar_t`, converts to the native wide
59
- encoding ([[fs.def.native.encode]]) using the
60
  `codecvt<wchar_t, char, mbstate_t>` facet of `loc`.
61
  - Otherwise a conversion is performed using the
62
  `codecvt<wchar_t, char, mbstate_t>` facet of `loc`, and then a second
63
- conversion to the current narrow encoding.
64
 
65
- Finds the detected-format of `s` ([[fs.path.fmt.cvt]]) and constructs
66
- an object of class `path` for which the pathname in that format is `s`.
67
 
68
  [*Example 1*:
69
 
70
  A string is to be read from a database that is encoded in ISO/IEC
71
  8859-1, and used to create a directory:
@@ -79,27 +76,27 @@ fs::create_directory(fs::path(latin1_string, latin1_locale));
79
  ```
80
 
81
  For POSIX-based operating systems, the path is constructed by first
82
  using `latin1_facet` to convert ISO/IEC 8859-1 encoded `latin1_string`
83
  to a wide character string in the native wide
84
- encoding ([[fs.def.native.encode]]). The resulting wide string is then
85
- converted to a narrow character pathname string in the current native
86
- narrow encoding. If the native wide encoding is UTF-16 or UTF-32, and
87
- the current native narrow encoding is UTF-8, all of the characters in
88
  the ISO/IEC 8859-1 character set will be converted to their Unicode
89
- representation, but for other native narrow encodings some characters
90
  may have no representation.
91
 
92
  For Windows-based operating systems, the path is constructed by using
93
  `latin1_facet` to convert ISO/IEC 8859-1 encoded `latin1_string` to a
94
  UTF-16 encoded wide character pathname string. All of the characters in
95
  the ISO/IEC 8859-1 character set will be converted to their Unicode
96
  representation.
97
 
98
  — *end example*]
99
 
100
- ##### `path` assignments <a id="fs.path.assign">[[fs.path.assign]]</a>
101
 
102
  ``` cpp
103
  path& operator=(const path& p);
104
  ```
105
 
@@ -139,18 +136,18 @@ template <class Source>
139
  path& assign(const Source& source);
140
  template<class InputIterator>
141
  path& assign(InputIterator first, InputIterator last);
142
  ```
143
 
144
- *Effects:* Let `s` be the effective range of `source` ([[fs.path.req]])
145
- or the range \[`first`, `last`), with the encoding converted if
146
- required ([[fs.path.cvt]]). Finds the detected-format of
147
- `s` ([[fs.path.fmt.cvt]]) and sets the pathname in that format to `s`.
148
 
149
  *Returns:* `*this`.
150
 
151
- ##### `path` appends <a id="fs.path.append">[[fs.path.append]]</a>
152
 
153
  The append operations use `operator/=` to denote their semantic effect
154
  of appending *preferred-separator* when needed.
155
 
156
  ``` cpp
@@ -173,26 +170,28 @@ Otherwise, modifies `*this` as if by these steps:
173
  pathname.
174
 
175
  [*Example 2*:
176
 
177
  Even if `//host` is interpreted as a *root-name*, both of the paths
178
- `path("//host")/"foo"` and `path("//host/")/"foo"` equal `"//host/foo"`.
 
179
 
180
  Expression examples:
181
 
182
  ``` cpp
183
  // On POSIX,
184
- path("foo") / ""; // yields "foo/"
185
- path("foo") / "/bar"; // yields "/bar"
186
- // On Windows, backslashes replace slashes in the above yields
187
 
188
  // On Windows,
189
- path("foo") / "c:/bar"; // yields "c:/bar"
190
- path("foo") / "c:"; // yields "c:"
191
- path("c:") / ""; // yields "c:"
192
- path("c:foo") / "/bar"; // yields "c:/bar"
193
- path("c:foo") / "c:bar"; // yields "c:foo/bar"
 
 
194
  ```
195
 
196
  — *end example*]
197
 
198
  *Returns:* `*this`.
@@ -211,22 +210,19 @@ template <class InputIterator>
211
  path& append(InputIterator first, InputIterator last);
212
  ```
213
 
214
  *Effects:* Equivalent to: `return operator/=(path(first, last));`
215
 
216
- ##### `path` concatenation <a id="fs.path.concat">[[fs.path.concat]]</a>
217
 
218
  ``` cpp
219
  path& operator+=(const path& x);
220
  path& operator+=(const string_type& x);
221
  path& operator+=(basic_string_view<value_type> x);
222
  path& operator+=(const value_type* x);
223
- path& operator+=(value_type x);
224
  template<class Source>
225
  path& operator+=(const Source& x);
226
- template <class EcharT>
227
- path& operator+=(EcharT x);
228
  template<class Source>
229
  path& concat(const Source& x);
230
  ```
231
 
232
  *Effects:* Appends `path(x).native()` to the pathname in the native
@@ -235,24 +231,32 @@ format.
235
  [*Note 2*: This directly manipulates the value of `native()` and may
236
  not be portable between operating systems. — *end note*]
237
 
238
  *Returns:* `*this`.
239
 
 
 
 
 
 
 
 
 
240
  ``` cpp
241
  template<class InputIterator>
242
  path& concat(InputIterator first, InputIterator last);
243
  ```
244
 
245
- *Effects:* Equivalent to `return *this += path(first, last)`.
246
 
247
- ##### `path` modifiers <a id="fs.path.modifiers">[[fs.path.modifiers]]</a>
248
 
249
  ``` cpp
250
  void clear() noexcept;
251
  ```
252
 
253
- *Postconditions:* `empty() == true`.
254
 
255
  ``` cpp
256
  path& make_preferred();
257
  ```
258
 
@@ -290,15 +294,15 @@ output is:
290
 
291
  ``` cpp
292
  path& remove_filename();
293
  ```
294
 
295
- *Postconditions:* `!has_filename()`.
296
-
297
  *Effects:* Remove the generic format pathname of `filename()` from the
298
  generic format pathname.
299
 
 
 
300
  *Returns:* `*this`.
301
 
302
  [*Example 4*:
303
 
304
  ``` cpp
@@ -336,12 +340,12 @@ path("/").replace_filename("bar"); // yields "/bar" on POSIX
336
  path& replace_extension(const path& replacement = path());
337
  ```
338
 
339
  *Effects:*
340
 
341
- - Any existing `extension()(` [[fs.path.decompose]]`)` is removed from
342
- the pathname in the generic format, then
343
  - If `replacement` is not empty and does not begin with a dot character,
344
  a dot character is appended to the pathname in the generic format,
345
  then
346
  - `operator+=(replacement);`.
347
 
@@ -353,14 +357,14 @@ void swap(path& rhs) noexcept;
353
 
354
  *Effects:* Swaps the contents (in all formats) of the two paths.
355
 
356
  *Complexity:* Constant time.
357
 
358
- ##### `path` native format observers <a id="fs.path.native.obs">[[fs.path.native.obs]]</a>
359
 
360
  The string returned by all native format observers is in the native
361
- pathname format ([[fs.def.native]]).
362
 
363
  ``` cpp
364
  const string_type& native() const noexcept;
365
  ```
366
 
@@ -368,11 +372,11 @@ const string_type& native() const noexcept;
368
 
369
  ``` cpp
370
  const value_type* c_str() const noexcept;
371
  ```
372
 
373
- *Returns:* Equivalent to `native().c_str()`.
374
 
375
  ``` cpp
376
  operator string_type() const;
377
  ```
378
 
@@ -396,26 +400,25 @@ be performed by `a`. Conversion, if any, is specified by
396
  [[fs.path.cvt]].
397
 
398
  ``` cpp
399
  std::string string() const;
400
  std::wstring wstring() const;
401
- std::string u8string() const;
402
  std::u16string u16string() const;
403
  std::u32string u32string() const;
404
  ```
405
 
406
- *Returns:* `pathstring`.
407
 
408
  *Remarks:* Conversion, if any, is performed as specified by
409
- [[fs.path.cvt]]. The encoding of the string returned by `u8string()` is
410
- always UTF-8.
411
 
412
- ##### `path` generic format observers <a id="fs.path.generic.obs">[[fs.path.generic.obs]]</a>
413
 
414
  Generic format observer functions return strings formatted according to
415
- the generic pathname format ([[fs.path.generic]]). A single slash
416
- (`'/'`) character is used as the *directory-separator*.
417
 
418
  [*Example 1*:
419
 
420
  On an operating system that uses backslash as its *preferred-separator*,
421
 
@@ -441,53 +444,51 @@ be performed by `a`. Conversion, if any, is specified by
441
  [[fs.path.cvt]].
442
 
443
  ``` cpp
444
  std::string generic_string() const;
445
  std::wstring generic_wstring() const;
446
- std::string generic_u8string() const;
447
  std::u16string generic_u16string() const;
448
  std::u32string generic_u32string() const;
449
  ```
450
 
451
  *Returns:* The pathname in the generic format.
452
 
453
- *Remarks:* Conversion, if any, is specified by  [[fs.path.cvt]]. The
454
- encoding of the string returned by `generic_u8string()` is always UTF-8.
455
 
456
- ##### `path` compare <a id="fs.path.compare">[[fs.path.compare]]</a>
457
 
458
  ``` cpp
459
  int compare(const path& p) const noexcept;
460
  ```
461
 
462
  *Returns:*
463
 
464
- - A value less than `0`, if `native()` for the elements of `*this` are
465
- lexicographically less than `native()` for the elements of `p`;
466
- otherwise,
467
- - a value greater than `0`, if `native()` for the elements of `*this`
468
- are lexicographically greater than `native()` for the elements of `p`;
469
- otherwise,
470
- - `0`.
471
-
472
- *Remarks:* The elements are determined as if by iteration over the
473
- half-open range \[`begin()`, `end()`) for `*this` and `p`.
 
 
 
 
474
 
475
  ``` cpp
476
- int compare(const string_type& s) const
477
  int compare(basic_string_view<value_type> s) const;
 
478
  ```
479
 
480
- *Returns:* `compare(path(s))`.
481
 
482
- ``` cpp
483
- int compare(const value_type* s) const
484
- ```
485
-
486
- *Returns:* `compare(path(s))`.
487
-
488
- ##### `path` decomposition <a id="fs.path.decompose">[[fs.path.decompose]]</a>
489
 
490
  ``` cpp
491
  path root_name() const;
492
  ```
493
 
@@ -510,20 +511,21 @@ path root_path() const;
510
  ``` cpp
511
  path relative_path() const;
512
  ```
513
 
514
  *Returns:* A `path` composed from the pathname in the generic format, if
515
- `!empty()`, beginning with the first *filename* after *root-path*.
516
- Otherwise, `path()`.
517
 
518
  ``` cpp
519
  path parent_path() const;
520
  ```
521
 
522
- *Returns:* `*this` if `!has_relative_path()`, otherwise a path whose
523
- generic format pathname is the longest prefix of the generic format
524
- pathname of `*this` that produces one fewer element in its iteration.
 
525
 
526
  ``` cpp
527
  path filename() const;
528
  ```
529
 
@@ -570,11 +572,11 @@ for (; !p.extension().empty(); p = p.stem())
570
 
571
  ``` cpp
572
  path extension() const;
573
  ```
574
 
575
- *Returns:* a path whose pathname in the generic format is the suffix of
576
  `filename()` not included in `stem()`.
577
 
578
  [*Example 8*:
579
 
580
  ``` cpp
@@ -593,18 +595,18 @@ extension. — *end note*]
593
 
594
  [*Note 5*: On non-POSIX operating systems, for a path `p`, it may not
595
  be the case that `p.stem() + p.extension() == p.filename()`, even though
596
  the generic format pathnames are the same. — *end note*]
597
 
598
- ##### `path` query <a id="fs.path.query">[[fs.path.query]]</a>
599
 
600
  ``` cpp
601
- bool empty() const noexcept;
602
  ```
603
 
604
- *Returns:* `true` if the pathname in the generic format is empty, else
605
- `false`.
606
 
607
  ``` cpp
608
  bool has_root_path() const;
609
  ```
610
 
@@ -655,11 +657,11 @@ bool has_extension() const;
655
  ``` cpp
656
  bool is_absolute() const;
657
  ```
658
 
659
  *Returns:* `true` if the pathname in the native format contains an
660
- absolute path ([[fs.def.absolute.path]]), else `false`.
661
 
662
  [*Example 9*: `path("/").is_absolute()` is `true` for POSIX-based
663
  operating systems, and `false` for Windows-based operating
664
  systems. — *end example*]
665
 
@@ -667,18 +669,18 @@ systems. — *end example*]
667
  bool is_relative() const;
668
  ```
669
 
670
  *Returns:* `!is_absolute()`.
671
 
672
- ##### `path` generation <a id="fs.path.gen">[[fs.path.gen]]</a>
673
 
674
  ``` cpp
675
  path lexically_normal() const;
676
  ```
677
 
678
  *Returns:* A path whose pathname in the generic format is the normal
679
- form ([[fs.def.normal.form]]) of the pathname in the generic format of
680
  `*this`.
681
 
682
  [*Example 10*:
683
 
684
  ``` cpp
@@ -695,29 +697,40 @@ slashes, but that does not affect `path` equality.
695
  ``` cpp
696
  path lexically_relative(const path& base) const;
697
  ```
698
 
699
  *Returns:* `*this` made relative to `base`. Does not
700
- resolve ([[fs.def.pathres]]) symlinks. Does not first
701
- normalize ([[fs.def.normal.form]]) `*this` or `base`.
702
-
703
- *Effects:* If `root_name() != base.root_name()` is `true` or
704
- `is_absolute() != base.is_absolute()` is `true` or
705
- `!has_root_directory() && base.has_root_directory()` is `true`, returns
706
- `path()`. Determines the first mismatched element of `*this` and `base`
707
- as if by:
 
 
 
 
 
 
 
 
 
708
 
709
  ``` cpp
710
  auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
711
  ```
712
 
713
  Then,
714
 
715
  - if `a == end()` and `b == base.end()`, returns `path(".")`; otherwise
716
  - let `n` be the number of *filename* elements in \[`b`, `base.end()`)
717
- that are not *dot* or *dot-dot* minus the number that are *dot-dot*.
718
- If `n<0,` returns `path()`; otherwise
 
 
719
  - returns an object of class `path` that is default-constructed,
720
  followed by
721
  - application of `operator/=(path(".."))` `n` times, and then
722
  - application of `operator/=` for each element in \[`a`, `end()`).
723
 
@@ -736,26 +749,26 @@ The above assertions will succeed. On Windows, the returned path’s
736
  *directory-separator* characters will be backslashes rather than
737
  slashes, but that does not affect `path` equality.
738
 
739
  — *end example*]
740
 
741
- [*Note 6*: If symlink following semantics are desired, use the
742
  operational function `relative()`. — *end note*]
743
 
744
- [*Note 7*: If normalization ([[fs.def.normal.form]]) is needed to
745
- ensure consistent matching of elements, apply `lexically_normal()` to
746
- `*this`, `base`, or both. — *end note*]
747
 
748
  ``` cpp
749
  path lexically_proximate(const path& base) const;
750
  ```
751
 
752
  *Returns:* If the value of `lexically_relative(base)` is not an empty
753
  path, return it. Otherwise return `*this`.
754
 
755
- [*Note 8*: If symlink following semantics are desired, use the
756
  operational function `proximate()`. — *end note*]
757
 
758
- [*Note 9*: If normalization ([[fs.def.normal.form]]) is needed to
759
- ensure consistent matching of elements, apply `lexically_normal()` to
760
- `*this`, `base`, or both. — *end note*]
761
 
 
1
+ #### Members <a id="fs.path.member">[[fs.path.member]]</a>
2
 
3
+ ##### Constructors <a id="fs.path.construct">[[fs.path.construct]]</a>
4
 
5
  ``` cpp
6
  path() noexcept;
7
  ```
8
 
9
+ *Ensures:* `empty() == true`.
 
 
10
 
11
  ``` cpp
12
  path(const path& p);
13
  path(path&& p) noexcept;
14
  ```
 
21
  ``` cpp
22
  path(string_type&& source, format fmt = auto_format);
23
  ```
24
 
25
  *Effects:* Constructs an object of class `path` for which the pathname
26
+ in the detected-format of `source` has the original value of `source`
27
+ [[fs.path.fmt.cvt]], converting format if required [[fs.path.fmt.cvt]].
28
+ `source` is left in a valid but unspecified state.
 
29
 
30
  ``` cpp
31
  template<class Source>
32
  path(const Source& source, format fmt = auto_format);
33
  template<class InputIterator>
34
  path(InputIterator first, InputIterator last, format fmt = auto_format);
35
  ```
36
 
37
+ *Effects:* Let `s` be the effective range of `source` [[fs.path.req]] or
38
+ the range \[`first`, `last`), with the encoding converted if
39
+ required [[fs.path.cvt]]. Finds the detected-format of `s`
40
+ [[fs.path.fmt.cvt]] and constructs an object of class `path` for which
41
+ the pathname in that format is `s`.
42
 
43
  ``` cpp
44
  template<class Source>
45
  path(const Source& source, const locale& loc, format fmt = auto_format);
46
  template<class InputIterator>
47
  path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format);
48
  ```
49
 
50
+ *Mandates:* The value type of `Source` and `InputIterator` is `char`.
51
 
52
  *Effects:* Let `s` be the effective range of `source` or the range
53
  \[`first`, `last`), after converting the encoding as follows:
54
 
55
  - If `value_type` is `wchar_t`, converts to the native wide
56
+ encoding [[fs.path.type.cvt]] using the
57
  `codecvt<wchar_t, char, mbstate_t>` facet of `loc`.
58
  - Otherwise a conversion is performed using the
59
  `codecvt<wchar_t, char, mbstate_t>` facet of `loc`, and then a second
60
+ conversion to the current ordinary encoding.
61
 
62
+ Finds the detected-format of `s` [[fs.path.fmt.cvt]] and constructs an
63
+ object of class `path` for which the pathname in that format is `s`.
64
 
65
  [*Example 1*:
66
 
67
  A string is to be read from a database that is encoded in ISO/IEC
68
  8859-1, and used to create a directory:
 
76
  ```
77
 
78
  For POSIX-based operating systems, the path is constructed by first
79
  using `latin1_facet` to convert ISO/IEC 8859-1 encoded `latin1_string`
80
  to a wide character string in the native wide
81
+ encoding [[fs.path.type.cvt]]. The resulting wide string is then
82
+ converted to an ordinary character pathname string in the current native
83
+ ordinary encoding. If the native wide encoding is UTF-16 or UTF-32, and
84
+ the current native ordinary encoding is UTF-8, all of the characters in
85
  the ISO/IEC 8859-1 character set will be converted to their Unicode
86
+ representation, but for other native ordinary encodings some characters
87
  may have no representation.
88
 
89
  For Windows-based operating systems, the path is constructed by using
90
  `latin1_facet` to convert ISO/IEC 8859-1 encoded `latin1_string` to a
91
  UTF-16 encoded wide character pathname string. All of the characters in
92
  the ISO/IEC 8859-1 character set will be converted to their Unicode
93
  representation.
94
 
95
  — *end example*]
96
 
97
+ ##### Assignments <a id="fs.path.assign">[[fs.path.assign]]</a>
98
 
99
  ``` cpp
100
  path& operator=(const path& p);
101
  ```
102
 
 
136
  path& assign(const Source& source);
137
  template<class InputIterator>
138
  path& assign(InputIterator first, InputIterator last);
139
  ```
140
 
141
+ *Effects:* Let `s` be the effective range of `source` [[fs.path.req]] or
142
+ the range \[`first`, `last`), with the encoding converted if
143
+ required [[fs.path.cvt]]. Finds the detected-format of `s`
144
+ [[fs.path.fmt.cvt]] and sets the pathname in that format to `s`.
145
 
146
  *Returns:* `*this`.
147
 
148
+ ##### Appends <a id="fs.path.append">[[fs.path.append]]</a>
149
 
150
  The append operations use `operator/=` to denote their semantic effect
151
  of appending *preferred-separator* when needed.
152
 
153
  ``` cpp
 
170
  pathname.
171
 
172
  [*Example 2*:
173
 
174
  Even if `//host` is interpreted as a *root-name*, both of the paths
175
+ `path("//host")/"foo"` and `path("//host/")/"foo"` equal `"//host/foo"`
176
+ (although the former might use backslash as the preferred separator).
177
 
178
  Expression examples:
179
 
180
  ``` cpp
181
  // On POSIX,
182
+ path("foo") /= path(""); // yields path("foo/")
183
+ path("foo") /= path("/bar"); // yields path("/bar")
 
184
 
185
  // On Windows,
186
+ path("foo") /= path(""); // yields path("foo\{")}
187
+ path("foo") /= path("/bar"); // yields path("/bar")
188
+ path("foo") /= path("c:/bar"); // yields path("c:/bar")
189
+ path("foo") /= path("c:"); // yields path("c:")
190
+ path("c:") /= path(""); // yields path("c:")
191
+ path("c:foo") /= path("/bar"); // yields path("c:/bar")
192
+ path("c:foo") /= path("c:bar"); // yields path("c:foo\{bar")}
193
  ```
194
 
195
  — *end example*]
196
 
197
  *Returns:* `*this`.
 
210
  path& append(InputIterator first, InputIterator last);
211
  ```
212
 
213
  *Effects:* Equivalent to: `return operator/=(path(first, last));`
214
 
215
+ ##### Concatenation <a id="fs.path.concat">[[fs.path.concat]]</a>
216
 
217
  ``` cpp
218
  path& operator+=(const path& x);
219
  path& operator+=(const string_type& x);
220
  path& operator+=(basic_string_view<value_type> x);
221
  path& operator+=(const value_type* x);
 
222
  template<class Source>
223
  path& operator+=(const Source& x);
 
 
224
  template<class Source>
225
  path& concat(const Source& x);
226
  ```
227
 
228
  *Effects:* Appends `path(x).native()` to the pathname in the native
 
231
  [*Note 2*: This directly manipulates the value of `native()` and may
232
  not be portable between operating systems. — *end note*]
233
 
234
  *Returns:* `*this`.
235
 
236
+ ``` cpp
237
+ path& operator+=(value_type x);
238
+ template<class EcharT>
239
+ path& operator+=(EcharT x);
240
+ ```
241
+
242
+ *Effects:* Equivalent to: `return *this += basic_string_view(&x, 1);`
243
+
244
  ``` cpp
245
  template<class InputIterator>
246
  path& concat(InputIterator first, InputIterator last);
247
  ```
248
 
249
+ *Effects:* Equivalent to: `return *this += path(first, last);`
250
 
251
+ ##### Modifiers <a id="fs.path.modifiers">[[fs.path.modifiers]]</a>
252
 
253
  ``` cpp
254
  void clear() noexcept;
255
  ```
256
 
257
+ *Ensures:* `empty() == true`.
258
 
259
  ``` cpp
260
  path& make_preferred();
261
  ```
262
 
 
294
 
295
  ``` cpp
296
  path& remove_filename();
297
  ```
298
 
 
 
299
  *Effects:* Remove the generic format pathname of `filename()` from the
300
  generic format pathname.
301
 
302
+ *Ensures:* `!has_filename()`.
303
+
304
  *Returns:* `*this`.
305
 
306
  [*Example 4*:
307
 
308
  ``` cpp
 
340
  path& replace_extension(const path& replacement = path());
341
  ```
342
 
343
  *Effects:*
344
 
345
+ - Any existing `extension()` [[fs.path.decompose]] is removed from the
346
+ pathname in the generic format, then
347
  - If `replacement` is not empty and does not begin with a dot character,
348
  a dot character is appended to the pathname in the generic format,
349
  then
350
  - `operator+=(replacement);`.
351
 
 
357
 
358
  *Effects:* Swaps the contents (in all formats) of the two paths.
359
 
360
  *Complexity:* Constant time.
361
 
362
+ ##### Native format observers <a id="fs.path.native.obs">[[fs.path.native.obs]]</a>
363
 
364
  The string returned by all native format observers is in the native
365
+ pathname format [[fs.class.path]].
366
 
367
  ``` cpp
368
  const string_type& native() const noexcept;
369
  ```
370
 
 
372
 
373
  ``` cpp
374
  const value_type* c_str() const noexcept;
375
  ```
376
 
377
+ *Effects:* Equivalent to: `return native().c_str();`
378
 
379
  ``` cpp
380
  operator string_type() const;
381
  ```
382
 
 
400
  [[fs.path.cvt]].
401
 
402
  ``` cpp
403
  std::string string() const;
404
  std::wstring wstring() const;
405
+ std::u8string u8string() const;
406
  std::u16string u16string() const;
407
  std::u32string u32string() const;
408
  ```
409
 
410
+ *Returns:* `native()`.
411
 
412
  *Remarks:* Conversion, if any, is performed as specified by
413
+ [[fs.path.cvt]].
 
414
 
415
+ ##### Generic format observers <a id="fs.path.generic.obs">[[fs.path.generic.obs]]</a>
416
 
417
  Generic format observer functions return strings formatted according to
418
+ the generic pathname format [[fs.path.generic]]. A single slash (`'/'`)
419
+ character is used as the *directory-separator*.
420
 
421
  [*Example 1*:
422
 
423
  On an operating system that uses backslash as its *preferred-separator*,
424
 
 
444
  [[fs.path.cvt]].
445
 
446
  ``` cpp
447
  std::string generic_string() const;
448
  std::wstring generic_wstring() const;
449
+ std::u8string generic_u8string() const;
450
  std::u16string generic_u16string() const;
451
  std::u32string generic_u32string() const;
452
  ```
453
 
454
  *Returns:* The pathname in the generic format.
455
 
456
+ *Remarks:* Conversion, if any, is specified by  [[fs.path.cvt]].
 
457
 
458
+ ##### Compare <a id="fs.path.compare">[[fs.path.compare]]</a>
459
 
460
  ``` cpp
461
  int compare(const path& p) const noexcept;
462
  ```
463
 
464
  *Returns:*
465
 
466
+ - Let `rootNameComparison` be the result of
467
+ `this->root_name().native().compare(p.root_name().native())`. If
468
+ `rootNameComparison` is not `0`, `rootNameComparison`.
469
+ - Otherwise, if `!this->has_root_directory()` and
470
+ `p.has_root_directory()`, a value less than `0`.
471
+ - Otherwise, if `this->has_root_directory()` and
472
+ `!p.has_root_directory()`, a value greater than `0`.
473
+ - Otherwise, if `native()` for the elements of `this->relative_path()`
474
+ are lexicographically less than `native()` for the elements of
475
+ `p.relative_path()`, a value less than `0`.
476
+ - Otherwise, if `native()` for the elements of `this->relative_path()`
477
+ are lexicographically greater than `native()` for the elements of
478
+ `p.relative_path()`, a value greater than `0`.
479
+ - Otherwise, `0`.
480
 
481
  ``` cpp
482
+ int compare(const string_type& s) const;
483
  int compare(basic_string_view<value_type> s) const;
484
+ int compare(const value_type* s) const;
485
  ```
486
 
487
+ *Effects:* Equivalent to: `return compare(path(s));`
488
 
489
+ ##### Decomposition <a id="fs.path.decompose">[[fs.path.decompose]]</a>
 
 
 
 
 
 
490
 
491
  ``` cpp
492
  path root_name() const;
493
  ```
494
 
 
511
  ``` cpp
512
  path relative_path() const;
513
  ```
514
 
515
  *Returns:* A `path` composed from the pathname in the generic format, if
516
+ `empty()` is `false`, beginning with the first *filename* after
517
+ `root_path()`. Otherwise, `path()`.
518
 
519
  ``` cpp
520
  path parent_path() const;
521
  ```
522
 
523
+ *Returns:* `*this` if `has_relative_path()` is `false`, otherwise a path
524
+ whose generic format pathname is the longest prefix of the generic
525
+ format pathname of `*this` that produces one fewer element in its
526
+ iteration.
527
 
528
  ``` cpp
529
  path filename() const;
530
  ```
531
 
 
572
 
573
  ``` cpp
574
  path extension() const;
575
  ```
576
 
577
+ *Returns:* A path whose pathname in the generic format is the suffix of
578
  `filename()` not included in `stem()`.
579
 
580
  [*Example 8*:
581
 
582
  ``` cpp
 
595
 
596
  [*Note 5*: On non-POSIX operating systems, for a path `p`, it may not
597
  be the case that `p.stem() + p.extension() == p.filename()`, even though
598
  the generic format pathnames are the same. — *end note*]
599
 
600
+ ##### Query <a id="fs.path.query">[[fs.path.query]]</a>
601
 
602
  ``` cpp
603
+ [[nodiscard]] bool empty() const noexcept;
604
  ```
605
 
606
+ *Returns:* `true` if the pathname in the generic format is empty,
607
+ otherwise `false`.
608
 
609
  ``` cpp
610
  bool has_root_path() const;
611
  ```
612
 
 
657
  ``` cpp
658
  bool is_absolute() const;
659
  ```
660
 
661
  *Returns:* `true` if the pathname in the native format contains an
662
+ absolute path [[fs.class.path]], otherwise `false`.
663
 
664
  [*Example 9*: `path("/").is_absolute()` is `true` for POSIX-based
665
  operating systems, and `false` for Windows-based operating
666
  systems. — *end example*]
667
 
 
669
  bool is_relative() const;
670
  ```
671
 
672
  *Returns:* `!is_absolute()`.
673
 
674
+ ##### Generation <a id="fs.path.gen">[[fs.path.gen]]</a>
675
 
676
  ``` cpp
677
  path lexically_normal() const;
678
  ```
679
 
680
  *Returns:* A path whose pathname in the generic format is the normal
681
+ form [[fs.path.generic]] of the pathname in the generic format of
682
  `*this`.
683
 
684
  [*Example 10*:
685
 
686
  ``` cpp
 
697
  ``` cpp
698
  path lexically_relative(const path& base) const;
699
  ```
700
 
701
  *Returns:* `*this` made relative to `base`. Does not
702
+ resolve [[fs.class.path]] symlinks. Does not first
703
+ normalize [[fs.path.generic]] `*this` or `base`.
704
+
705
+ *Effects:* If:
706
+
707
+ - `root_name() != base.root_name()` is `true`, or
708
+ - `is_absolute() != base.is_absolute()` is `true`, or
709
+ - `!has_root_directory() && base.has_root_directory()` is `true`, or
710
+ - any *filename* in `relative_path()` or `base.relative_path()` can be
711
+ interpreted as a *root-name*,
712
+
713
+ returns `path()`.
714
+
715
+ [*Note 6*: On a POSIX implementation, no *filename* in a
716
+ *relative-path* is acceptable as a *root-name*. — *end note*]
717
+
718
+ Determines the first mismatched element of `*this` and `base` as if by:
719
 
720
  ``` cpp
721
  auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
722
  ```
723
 
724
  Then,
725
 
726
  - if `a == end()` and `b == base.end()`, returns `path(".")`; otherwise
727
  - let `n` be the number of *filename* elements in \[`b`, `base.end()`)
728
+ that are not dot or dot-dot or empty, minus the number that are
729
+ dot-dot. If `n<0,` returns `path()`; otherwise
730
+ - if `n == 0` and `(a == end() || a->empty())`, returns `path(".")`;
731
+ otherwise
732
  - returns an object of class `path` that is default-constructed,
733
  followed by
734
  - application of `operator/=(path(".."))` `n` times, and then
735
  - application of `operator/=` for each element in \[`a`, `end()`).
736
 
 
749
  *directory-separator* characters will be backslashes rather than
750
  slashes, but that does not affect `path` equality.
751
 
752
  — *end example*]
753
 
754
+ [*Note 7*: If symlink following semantics are desired, use the
755
  operational function `relative()`. — *end note*]
756
 
757
+ [*Note 8*: If normalization [[fs.path.generic]] is needed to ensure
758
+ consistent matching of elements, apply `lexically_normal()` to `*this`,
759
+ `base`, or both. — *end note*]
760
 
761
  ``` cpp
762
  path lexically_proximate(const path& base) const;
763
  ```
764
 
765
  *Returns:* If the value of `lexically_relative(base)` is not an empty
766
  path, return it. Otherwise return `*this`.
767
 
768
+ [*Note 9*: If symlink following semantics are desired, use the
769
  operational function `proximate()`. — *end note*]
770
 
771
+ [*Note 10*: If normalization [[fs.path.generic]] is needed to ensure
772
+ consistent matching of elements, apply `lexically_normal()` to `*this`,
773
+ `base`, or both. — *end note*]
774