From Jason Turner

[fs.path.nonmember]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpa2p289qo/{from.md → to.md} +11 -119
tmp/tmpa2p289qo/{from.md → to.md} RENAMED
@@ -1,160 +1,52 @@
1
- #### `path` non-member functions <a id="fs.path.nonmember">[[fs.path.nonmember]]</a>
2
 
3
  ``` cpp
4
  void swap(path& lhs, path& rhs) noexcept;
5
  ```
6
 
7
- *Effects:* Equivalent to: `lhs.swap(rhs);`
8
 
9
  ``` cpp
10
  size_t hash_value (const path& p) noexcept;
11
  ```
12
 
13
  *Returns:* A hash value for the path `p`. If for two paths, `p1 == p2`
14
  then `hash_value(p1) == hash_value(p2)`.
15
 
16
  ``` cpp
17
- bool operator< (const path& lhs, const path& rhs) noexcept;
18
  ```
19
 
20
- *Returns:* `lhs.compare(rhs) < 0`.
21
-
22
- ``` cpp
23
- bool operator<=(const path& lhs, const path& rhs) noexcept;
24
- ```
25
-
26
- *Returns:* `!(rhs < lhs)`.
27
-
28
- ``` cpp
29
- bool operator> (const path& lhs, const path& rhs) noexcept;
30
- ```
31
-
32
- *Returns:* `rhs < lhs`.
33
-
34
- ``` cpp
35
- bool operator>=(const path& lhs, const path& rhs) noexcept;
36
- ```
37
-
38
- *Returns:* `!(lhs < rhs)`.
39
-
40
- ``` cpp
41
- bool operator==(const path& lhs, const path& rhs) noexcept;
42
- ```
43
-
44
- *Returns:* `!(lhs < rhs) && !(rhs < lhs)`.
45
 
46
  [*Note 1*:
47
 
48
  Path equality and path equivalence have different semantics.
49
 
50
  - Equality is determined by the `path` non-member `operator==`, which
51
- considers the two paths lexical representations only.
52
  \[*Example 1*: `path("foo") == "bar"` is never
53
  `true`. — *end example*]
54
  - Equivalence is determined by the `equivalent()` non-member function,
55
- which determines if two paths resolve ([[fs.def.pathres]]) to the
56
- same file system entity. \[*Example 2*: `equivalent("foo", "bar")`
57
- will be `true` when both paths resolve to the same
58
- file. — *end example*]
59
 
60
  Programmers wishing to determine if two paths are “the same” must decide
61
  if “the same” means “the same representation” or “resolve to the same
62
  actual file”, and choose the appropriate function accordingly.
63
 
64
  — *end note*]
65
 
66
  ``` cpp
67
- bool operator!=(const path& lhs, const path& rhs) noexcept;
68
  ```
69
 
70
- *Returns:* `!(lhs == rhs)`.
71
 
72
  ``` cpp
73
- path operator/ (const path& lhs, const path& rhs);
74
  ```
75
 
76
  *Effects:* Equivalent to: `return path(lhs) /= rhs;`
77
 
78
- ##### `path` inserter and extractor <a id="fs.path.io">[[fs.path.io]]</a>
79
-
80
- ``` cpp
81
- template <class charT, class traits>
82
- basic_ostream<charT, traits>&
83
- operator<<(basic_ostream<charT, traits>& os, const path& p);
84
- ```
85
-
86
- *Effects:* Equivalent to: `os << quoted(p.string<charT, traits>());`
87
-
88
- [*Note 2*: The `quoted` function is described
89
- in  [[quoted.manip]]. — *end note*]
90
-
91
- *Returns:* `os`.
92
-
93
- ``` cpp
94
- template <class charT, class traits>
95
- basic_istream<charT, traits>&
96
- operator>>(basic_istream<charT, traits>& is, path& p);
97
- ```
98
-
99
- *Effects:* Equivalent to:
100
-
101
- ``` cpp
102
- basic_string<charT, traits> tmp;
103
- is >> quoted(tmp);
104
- p = tmp;
105
- ```
106
-
107
- *Returns:* `is`.
108
-
109
- ##### `path` factory functions <a id="fs.path.factory">[[fs.path.factory]]</a>
110
-
111
- ``` cpp
112
- template <class Source>
113
- path u8path(const Source& source);
114
- template <class InputIterator>
115
- path u8path(InputIterator first, InputIterator last);
116
- ```
117
-
118
- *Requires:* The `source` and \[`first`, `last`) sequences are UTF-8
119
- encoded. The value type of `Source` and `InputIterator` is `char`.
120
-
121
- *Returns:*
122
-
123
- - If `value_type` is `char` and the current native narrow
124
- encoding ([[fs.def.native.encode]]) is UTF-8, return `path(source)`
125
- or `path(first, last)`; otherwise,
126
- - if `value_type` is `wchar_t` and the native wide encoding is UTF-16,
127
- or if `value_type` is `char16_t` or `char32_t`, convert `source` or
128
- \[`first`, `last`) to a temporary, `tmp`, of type `string_type` and
129
- return `path(tmp)`; otherwise,
130
- - convert `source` or \[`first`, `last`) to a temporary, `tmp`, of type
131
- `u32string` and return `path(tmp)`.
132
-
133
- *Remarks:* Argument format conversion ([[fs.path.fmt.cvt]]) applies to
134
- the arguments for these functions. How Unicode encoding conversions are
135
- performed is unspecified.
136
-
137
- [*Example 1*:
138
-
139
- A string is to be read from a database that is encoded in UTF-8, and
140
- used to create a directory using the native encoding for filenames:
141
-
142
- ``` cpp
143
- namespace fs = std::filesystem;
144
- std::string utf8_string = read_utf8_data();
145
- fs::create_directory(fs::u8path(utf8_string));
146
- ```
147
-
148
- For POSIX-based operating systems with the native narrow encoding set to
149
- UTF-8, no encoding or type conversion occurs.
150
-
151
- For POSIX-based operating systems with the native narrow encoding not
152
- set to UTF-8, a conversion to UTF-32 occurs, followed by a conversion to
153
- the current native narrow encoding. Some Unicode characters may have no
154
- native character set representation.
155
-
156
- For Windows-based operating systems a conversion from UTF-8 to UTF-16
157
- occurs.
158
-
159
- — *end example*]
160
-
 
1
+ #### Non-member functions <a id="fs.path.nonmember">[[fs.path.nonmember]]</a>
2
 
3
  ``` cpp
4
  void swap(path& lhs, path& rhs) noexcept;
5
  ```
6
 
7
+ *Effects:* Equivalent to `lhs.swap(rhs)`.
8
 
9
  ``` cpp
10
  size_t hash_value (const path& p) noexcept;
11
  ```
12
 
13
  *Returns:* A hash value for the path `p`. If for two paths, `p1 == p2`
14
  then `hash_value(p1) == hash_value(p2)`.
15
 
16
  ``` cpp
17
+ friend bool operator==(const path& lhs, const path& rhs) noexcept;
18
  ```
19
 
20
+ *Returns:* `lhs.compare(rhs) == 0`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  [*Note 1*:
23
 
24
  Path equality and path equivalence have different semantics.
25
 
26
  - Equality is determined by the `path` non-member `operator==`, which
27
+ considers the two paths’ lexical representations only.
28
  \[*Example 1*: `path("foo") == "bar"` is never
29
  `true`. — *end example*]
30
  - Equivalence is determined by the `equivalent()` non-member function,
31
+ which determines if two paths resolve [[fs.class.path]] to the same
32
+ file system entity. \[*Example 2*: `equivalent("foo", "bar")` will be
33
+ `true` when both paths resolve to the same file. — *end example*]
 
34
 
35
  Programmers wishing to determine if two paths are “the same” must decide
36
  if “the same” means “the same representation” or “resolve to the same
37
  actual file”, and choose the appropriate function accordingly.
38
 
39
  — *end note*]
40
 
41
  ``` cpp
42
+ friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept;
43
  ```
44
 
45
+ *Returns:* `lhs.compare(rhs) <=> 0`.
46
 
47
  ``` cpp
48
+ friend path operator/ (const path& lhs, const path& rhs);
49
  ```
50
 
51
  *Effects:* Equivalent to: `return path(lhs) /= rhs;`
52