C++ Logo

sg16

Advanced search

Re: [SG16] Agenda for the 2021-12-15 SG16 telecon

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Sun, 12 Dec 2021 23:26:12 +0100
On 12/12/2021 22.45, Barry Revzin wrote:
>
>
> On Sun, Dec 12, 2021 at 2:20 PM Jens Maurer <Jens.Maurer_at_[hidden] <mailto:Jens.Maurer_at_[hidden]>> wrote:
>
> But that range of ints will match formatter<R>, too, I guess?
> If formatter<R> derives from range_formatter<range_reference_t<R>>,
> using a formatter<R> seems to also instantiate range_formatter.
> If the latter doesn't exist, those template instantiations are
> saved.
>
>
> Yes, but you only have to instantiate parse() once per (cvref-unqualified) reference type rather than once per range type.

But that's QoI, isn't it?

> > It's just more user friendly. They can use formatter<R> if they really want to too, this is just more direct.
>
> I don't understand.
>
> Could you point me to a section in the paper that specifically
> addresses that having both range_formatter<V> and a partial
> specialization for formatter<R> is "more user-friendly"?
> I thought those formatters were intended as helpers for
> std::format, anyway?
>
> Jens
>
>
> There isn't a section in the paper for it, it was asked for in one of the LEWG telecons. They are intended as helpers for std::format (indeed, they have... no other use whatsoever), but when you're defining a formatter specialization for your own type, and your type might have range members, it could affect how you would implement your formatter specialization if you actually want to go ahead and handle specifiers and the like.

"it could affect" certainly begs for specifics.

Jens

Received on 2021-12-12 16:26:19