> Tomorrow, who knows -- thus my concern that we need to be aligned with > upstream, or we risk divergence. Cf. for example this approach: > >> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2728r6.html#add-utf_view-specialization-of-formatter
Thanks for the link. If the paper gets accepted, then we need to convert to UTF-8, indeed. > SG16 is one of the most open and welcoming C++ study groups. You can > find plenty of resources here https://github.com/sg16-unicode/sg16 . > Their mailing list (reflector) is here > https://lists.isocpp.org/mailman/listinfo.cgi/sg16 . Thanks again for the links. I'll try to ask in their mailing list. > We also would like to have the ability to allocate > buffer in the output, write to it, and only then let the output know how much > we've written. I could not find a way to do that with std::formatter. IIUC, the problem of extra allocations is covered by the transcoding iterators and views in the paper that was linked by Giuseppe. Best regards, Ivan ------------------------------ Ivan Solovev Senior Software Engineer The Qt Company GmbH Erich-Thilo-Str. 10 12489 Berlin, Germany ivan.solo...@qt.io www.qt.io Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B ________________________________________ From: Development <development-boun...@qt-project.org> on behalf of Thiago Macieira <thiago.macie...@intel.com> Sent: Friday, June 7, 2024 3:41 PM To: development@qt-project.org Subject: Re: [Development] std::format support for Qt string types On Friday 7 June 2024 01:53:55 GMT-7 Ivan Solovev via Development wrote: > Note that currently the standard does not allow to mix char and wide char > strings, so something like this will not work: > > std::wstring wstr = ~~~; > std::format("{}", wstr); // ERROR! > > That would mean the following: > * std::formatter<QString(View), wchar_t>, which will simply call > QString::toStdWString() and format the resulting std::wstring. In addition to what Peppe and Eddy said, I recommend we completely ignore wchar_t. It's not useful to us because it's only useful in one platform. It might be that SG16 hasn't tackled formatting onto char16_t and char32_t and formatting of std::u16string and std::u32string and similar *because* they have yet to come up with functions to do transcoding. But we won't know unless we ask. Or we'll find out that "it's what fmtlib did, so no one has looked into that". We have and we need it. We also would like to have the ability to allocate buffer in the output, write to it, and only then let the output know how much we've written. I could not find a way to do that with std::formatter. -- Thiago Macieira - thiago.macieira (AT) intel.com Principal Engineer - Intel DCAI Fleet Engineering and Quality -- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development