From Jason Turner

[depr.fs.path.factory]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8_e6rsmp/{from.md → to.md} +58 -0
tmp/tmp8_e6rsmp/{from.md → to.md} RENAMED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Deprecated filesystem path factory functions <a id="depr.fs.path.factory">[[depr.fs.path.factory]]</a>
2
+
3
+ ``` cpp
4
+ template<class Source>
5
+ path u8path(const Source& source);
6
+ template<class InputIterator>
7
+ path u8path(InputIterator first, InputIterator last);
8
+ ```
9
+
10
+ *Requires:* The `source` and \[`first`, `last`) sequences are UTF-8
11
+ encoded. The value type of `Source` and `InputIterator` is `char` or
12
+ `char8_t`. `Source` meets the requirements specified in [[fs.path.req]].
13
+
14
+ *Returns:*
15
+
16
+ - If `value_type` is `char` and the current native narrow
17
+ encoding [[fs.path.type.cvt]] is UTF-8, return `path(source)` or
18
+ `path(first, last)`; otherwise,
19
+ - if `value_type` is `wchar_t` and the native wide encoding is UTF-16,
20
+ or if `value_type` is `char16_t` or `char32_t`, convert `source` or
21
+ \[`first`, `last`) to a temporary, `tmp`, of type `string_type` and
22
+ return `path(tmp)`; otherwise,
23
+ - convert `source` or \[`first`, `last`) to a temporary, `tmp`, of type
24
+ `u32string` and return `path(tmp)`.
25
+
26
+ *Remarks:* Argument format conversion [[fs.path.fmt.cvt]] applies to the
27
+ arguments for these functions. How Unicode encoding conversions are
28
+ performed is unspecified.
29
+
30
+ [*Example 1*:
31
+
32
+ A string is to be read from a database that is encoded in UTF-8, and
33
+ used to create a directory using the native encoding for filenames:
34
+
35
+ ``` cpp
36
+ namespace fs = std::filesystem;
37
+ std::string utf8_string = read_utf8_data();
38
+ fs::create_directory(fs::u8path(utf8_string));
39
+ ```
40
+
41
+ For POSIX-based operating systems with the native narrow encoding set to
42
+ UTF-8, no encoding or type conversion occurs.
43
+
44
+ For POSIX-based operating systems with the native narrow encoding not
45
+ set to UTF-8, a conversion to UTF-32 occurs, followed by a conversion to
46
+ the current native narrow encoding. Some Unicode characters may have no
47
+ native character set representation.
48
+
49
+ For Windows-based operating systems a conversion from UTF-8 to UTF-16
50
+ occurs.
51
+
52
+ — *end example*]
53
+
54
+ [*Note 1*: The example above is representative of a historical use of
55
+ `filesystem::u8path`. Passing a `std::u8string` to `path`’s constructor
56
+ is preferred for an indication of UTF-8 encoding more consistent with
57
+ `path`’s handling of other encodings. — *end note*]
58
+