From Jason Turner

[fs.path.factory]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwyqs2gmm/{from.md → to.md} +52 -0
tmp/tmpwyqs2gmm/{from.md → to.md} RENAMED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### `path` factory functions <a id="fs.path.factory">[[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`.
12
+
13
+ *Returns:*
14
+
15
+ - If `value_type` is `char` and the current native narrow
16
+ encoding ([[fs.def.native.encode]]) is UTF-8, return `path(source)`
17
+ or `path(first, last)`; otherwise,
18
+ - if `value_type` is `wchar_t` and the native wide encoding is UTF-16,
19
+ or if `value_type` is `char16_t` or `char32_t`, convert `source` or
20
+ \[`first`, `last`) to a temporary, `tmp`, of type `string_type` and
21
+ return `path(tmp)`; otherwise,
22
+ - convert `source` or \[`first`, `last`) to a temporary, `tmp`, of type
23
+ `u32string` and return `path(tmp)`.
24
+
25
+ *Remarks:* Argument format conversion ([[fs.path.fmt.cvt]]) applies to
26
+ the arguments for these functions. How Unicode encoding conversions are
27
+ performed is unspecified.
28
+
29
+ [*Example 1*:
30
+
31
+ A string is to be read from a database that is encoded in UTF-8, and
32
+ used to create a directory using the native encoding for filenames:
33
+
34
+ ``` cpp
35
+ namespace fs = std::filesystem;
36
+ std::string utf8_string = read_utf8_data();
37
+ fs::create_directory(fs::u8path(utf8_string));
38
+ ```
39
+
40
+ For POSIX-based operating systems with the native narrow encoding set to
41
+ UTF-8, no encoding or type conversion occurs.
42
+
43
+ For POSIX-based operating systems with the native narrow encoding not
44
+ set to UTF-8, a conversion to UTF-32 occurs, followed by a conversion to
45
+ the current native narrow encoding. Some Unicode characters may have no
46
+ native character set representation.
47
+
48
+ For Windows-based operating systems a conversion from UTF-8 to UTF-16
49
+ occurs.
50
+
51
+ — *end example*]
52
+