C++ Logo

sg16

Advanced search

[SG16-Unicode] SG16 approval for LEWG to review std::filesystem::path_view

From: Niall Douglas <s_sourceforge_at_[hidden]>
Date: Wed, 3 Jul 2019 16:11:10 +0100
Dear SG16,

Titus would like to know if SG16 has no objection to LEWG reviewing
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1030r2.pdf
"std::filesystem::path_view" at the Cologne meeting? SG16 approval is
sought because P1030 depends on P0482 char8_t.

To explain the dependency, path_view really wants to avoid ever copying
memory. This means we cannot use the same API as filesystem::path. So,
if on Windows you write:

path_view(u16"c:/some/path");

... then the literal string gets passed directly through to the wide
character Windows syscalls, uncopied. If on POSIX, it would undergo a
just-in-time downconversion to UTF-8.

This works by path_view inspecting the char literal passed to it for its
type. It refuses to accept `char`, it will only accept byte [1],
char8_t, char16_t and char32_t. In other words, you must explicitly
specify the UTF encoding for path view input.

Is SG16 happy for LEWG to review P1030?

Niall

[1]: Raw bytes are accepted because most filesystems will actually
accept raw binary bytes (minus a few reserved values such as '/' or 0)
as path identifiers without issue. There is no interpretation done based
on Unicode. Thus, not supporting raw bytes makes many valid filenames
impossible to work with.

Received on 2019-07-03 17:11:13