C++ Logo

sg16

Advanced search

[isocpp-sg16] std::format and charN_t

From: Ivan Solovev <ivan.solovev_at_[hidden]>
Date: Mon, 10 Jun 2024 11:38:57 +0000
Hello, I'm one of the contributors to the Qt Project, and I'm now working on adding std::format support for Qt string types. I have some questions that I'd like to clarify with the SG16 group. Qt string types include: * QString and QStringView: owning container and non-owning view on UTF-16 data * QUtf8StringView: non-owning view on UTF-8 data * QLatin1StringView: non-owning view on Latin1 data What I'm trying to do is to provide std::formatter<QT_STRING_TYPE, char> for each of the string types mentioned above. The tricky question here is - which encoding should be used for the generated char string? We are discussing it in the Qt Project mailing list (link to the discussion: https://lists.qt-project.org/pipermail/development/2024-June/045380.html), and we're currently leaning towards encoding everything in UTF-8. But before going forward, we wanted to check with SG16 to make sure that we do not end up with something that will cause compatibility issues in future. So, my questions are: * Are there any plans to support charN_t formatters in the standard? * How std::formatter<charN_t, char> would behave in this case? I've read https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2728r6.html#add-utf_view-specialization-of-formatter and it looks like UTF-8 is the right choice if it gets accepted. How probable is that? Are there any other papers related to this topic? I've seen https://lists.isocpp.org/sg16/2024/05/4305.php but the link to the draft of the paper in that email does not work for me. I'd appreciate any comments about the current state and future plans of charN_t support in std::format. Thanks, Ivan ------------------------------ Ivan Solovev Senior Software Engineer The Qt Company GmbH Erich-Thilo-Str. 10 12489 Berlin, Germany ivan.solovev_at_[hidden] www.qt.io Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

Received on 2024-06-10 11:39:03