[fs.path.cvt]
31 Input/output library [input.output]
31.12 File systems [filesystems]
31.12.6 Class path [fs.class.path]
31.12.6.3 Conversions [fs.path.cvt]
31.12.6.3.1 Argument format conversions [fs.path.fmt.cvt]
31.12.6.3.2 Type and encoding conversions [fs.path.type.cvt]
31.12.6.3.1 Argument format conversions [fs.path.fmt.cvt]
[Note 1:
The format conversions described in this subclause are not applied on POSIX-based operating systems because on these systems:
— end note]
Several functions are defined to accept detected-format arguments, which are character sequences.
A detected-format argument represents a path using either a pathname in the generic format ([fs.path.generic]) or a pathname in the native format ([fs.class.path]).
Such an argument is taken to be in the generic format if and only if it matches the generic format and is not acceptable to the operating system as a native path.
[Note 2:
Some operating systems have no unambiguous way to distinguish between native format and generic format arguments.
This is by design as it simplifies use for operating systems that do not require disambiguation.
It is possible that an implementation for an operating system where disambiguation is needed distinguishes between the formats.
— end note]
Pathnames are converted as needed between the generic and native formats in an operating-system-dependent manner.
Let G(n) and N(g) in a mathematical sense be the implementation's functions that convert native-to-generic and generic-to-native formats respectively.
If g=G(n) for some n, then G(N(g))=g; if n=N(g) for some g, then N(G(n))=n.
If the native format requires paths for regular files to be formatted differently from paths for directories, the path shall be treated as a directory path if its last element is a directory-separator, otherwise it shall be treated as a path to a regular file.
[Note 4:
A path stores a native format pathname ([fs.path.native.obs]) and acts as if it also stores a generic format pathname, related as given below.
The implementation can generate the generic format pathname based on the native format pathname (and possibly other information) when requested.
— end note]
When a path is constructed from or is assigned a single representation separate from any path, the other representation is selected by the appropriate conversion function (G or N).
When the (new) value p of one representation of a path is derived from the representation of that or another path, a value q is chosen for the other representation.
The value q converts to p (by G or N as appropriate) if any such value does so; q is otherwise unspecified.
31.12.6.3.2 Type and encoding conversions [fs.path.type.cvt]
The native encoding of an ordinary character string is the operating system dependent current encoding for pathnames ([fs.class.path]).
The native encoding for wide character strings is the implementation-defined execution wide-character set encoding ([character.seq]).
For member function arguments that take character sequences representing paths and for member functions returning strings, value type and encoding conversion is performed if the value type of the argument or return value differs from path::value_type.
For the argument or return value, the method of conversion and the encoding to be converted to is determined by its value type: