C++ Logo

sg16

Advanced search

Re: [isocpp-lib-ext] Formatters converting sequences of char to sequences of wchar_t

From: Peter Brett <pbrett_at_[hidden]>
Date: Thu, 8 Jun 2023 08:36:19 +0000
Hi all,

I think this is the correct solution. Hopefully we can discuss the LWG issue in the next SG16 meeting.

Best regards,

           Peter

From: SG16 <sg16-bounces_at_[hidden]> On Behalf Of Victor Zverovich via SG16
Sent: 07 June 2023 19:09
To: Mark de Wever <koraq_at_[hidden]>
Cc: Victor Zverovich <victor.zverovich_at_[hidden]ail.com>; Tom Honermann via Lib-Ext <lib-ext_at_[hidden]>; Tom Honermann <tom_at_[hidden]>; SG16 <sg16_at_[hidden]>; Barry Revzin <barry.revzin_at_[hidden]>
Subject: Re: [SG16] [isocpp-lib-ext] Formatters converting sequences of char to sequences of wchar_t

EXTERNAL MAIL
OK, I finally found time to look into this in detail and now convinced that the correct solution is to update http://eel.is/c++draft/format#formatter.spec<https://urldefense.com/v3/__http:/eel.is/c**Adraft/format*formatter.spec__;Kysj!!EHscmS1ygiU1lA!FfpuU-1g0hRTErFAaL-DdzXCLxnNpeno33EyhkdNsBeUn8gMNrgJZsT8lLlBLui7LBrrf3a_yj1d3-s$> disabling all formatters listed there that may mix code unit types except for formatter<char, wchar_t>. Previously they were disabled implicitly but C++23 inadvertently enabled them. For example, we should disable

  template<class traits, class Allocator>
    struct formatter<basic_string<charT, traits, Allocator>, Char>;

when Char is different from charT.

Cheers,
Victor

On Thu, Jun 1, 2023 at 11:52 AM Mark de Wever <koraq_at_[hidden]<mailto:koraq_at_[hidden]>> wrote:
On Thu, Jun 01, 2023 at 12:20:59PM -0400, Tom Honermann via Lib-Ext wrote:
> On 5/31/23 1:29 PM, Victor Zverovich via Lib-Ext wrote:
> > Thanks for catching this, it looks like a serious problem.
> >
> > - Do we want to allow string types of chars to be formatted as
> > sequences of wchar_ts?
> >
> > Definitely not. In general this requires transcoding and goes against
> > the design of std::format.
> >
> > - Do we want to allow non string type sequences of chars to be
> > formatted as sequences of wchar_ts?
> >
> > Similarly no.
> >
> > - Should we disable char to wchar_t conversion in the range_formatter?
> >
> > Probably yes but I haven't looked in detail yet.
> My intuition matches Victor's for all three questions.
> >
> > Please open an LWG issue and we'll need to discuss it in SG16.
>
> Please copy me on the LWG issue request and I'll schedule it for discussion
> in SG16 once it has been created.

Victor, Tom, thanks for the input. I just filed an LWG issue.

Cheers,
Mark

Received on 2023-06-08 08:36:26