From Jason Turner

[fs.path.construct]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp889yk99z/{from.md → to.md} +97 -0
tmp/tmp889yk99z/{from.md → to.md} RENAMED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### `path` constructors <a id="fs.path.construct">[[fs.path.construct]]</a>
2
+
3
+ ``` cpp
4
+ path() noexcept;
5
+ ```
6
+
7
+ *Effects:* Constructs an object of class `path`.
8
+
9
+ *Postconditions:* `empty() == true`.
10
+
11
+ ``` cpp
12
+ path(const path& p);
13
+ path(path&& p) noexcept;
14
+ ```
15
+
16
+ *Effects:* Constructs an object of class `path` having the same pathname
17
+ in the native and generic formats, respectively, as the original value
18
+ of `p`. In the second form, `p` is left in a valid but unspecified
19
+ state.
20
+
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
27
+ `source` ([[fs.path.fmt.cvt]]), converting format if
28
+ required ([[fs.path.fmt.cvt]]). `source` is left in a valid but
29
+ unspecified state.
30
+
31
+ ``` cpp
32
+ template <class Source>
33
+ path(const Source& source, format fmt = auto_format);
34
+ template <class InputIterator>
35
+ path(InputIterator first, InputIterator last, format fmt = auto_format);
36
+ ```
37
+
38
+ *Effects:* Let `s` be the effective range of `source` ([[fs.path.req]])
39
+ or the range \[`first`, `last`), with the encoding converted if
40
+ required ([[fs.path.cvt]]). Finds the detected-format of
41
+ `s` ([[fs.path.fmt.cvt]]) and constructs an object of class `path` for
42
+ which the pathname in that format is `s`.
43
+
44
+ ``` cpp
45
+ template <class Source>
46
+ path(const Source& source, const locale& loc, format fmt = auto_format);
47
+ template <class InputIterator>
48
+ path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format);
49
+ ```
50
+
51
+ *Requires:* The value type of `Source` and `InputIterator` is `char`.
52
+
53
+ *Effects:* Let `s` be the effective range of `source` or the range
54
+ \[`first`, `last`), after converting the encoding as follows:
55
+
56
+ - If `value_type` is `wchar_t`, converts to the native wide
57
+ encoding ([[fs.def.native.encode]]) using the
58
+ `codecvt<wchar_t, char, mbstate_t>` facet of `loc`.
59
+ - Otherwise a conversion is performed using the
60
+ `codecvt<wchar_t, char, mbstate_t>` facet of `loc`, and then a second
61
+ conversion to the current narrow encoding.
62
+
63
+ Finds the detected-format of `s` ([[fs.path.fmt.cvt]]) and constructs
64
+ an object of class `path` for which the pathname in that format is `s`.
65
+
66
+ [*Example 1*:
67
+
68
+ A string is to be read from a database that is encoded in ISO/IEC
69
+ 8859-1, and used to create a directory:
70
+
71
+ ``` cpp
72
+ namespace fs = std::filesystem;
73
+ std::string latin1_string = read_latin1_data();
74
+ codecvt_8859_1<wchar_t> latin1_facet;
75
+ std::locale latin1_locale(std::locale(), latin1_facet);
76
+ fs::create_directory(fs::path(latin1_string, latin1_locale));
77
+ ```
78
+
79
+ For POSIX-based operating systems, the path is constructed by first
80
+ using `latin1_facet` to convert ISO/IEC 8859-1 encoded `latin1_string`
81
+ to a wide character string in the native wide
82
+ encoding ([[fs.def.native.encode]]). The resulting wide string is then
83
+ converted to a narrow character pathname string in the current native
84
+ narrow encoding. If the native wide encoding is UTF-16 or UTF-32, and
85
+ the current native narrow encoding is UTF-8, all of the characters in
86
+ the ISO/IEC 8859-1 character set will be converted to their Unicode
87
+ representation, but for other native narrow encodings some characters
88
+ may have no representation.
89
+
90
+ For Windows-based operating systems, the path is constructed by using
91
+ `latin1_facet` to convert ISO/IEC 8859-1 encoded `latin1_string` to a
92
+ UTF-16 encoded wide character pathname string. All of the characters in
93
+ the ISO/IEC 8859-1 character set will be converted to their Unicode
94
+ representation.
95
+
96
+ — *end example*]
97
+