C++ Logo

std-discussion

Advanced search

Re: format_to (a char array) easy to misuse

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 4 Oct 2022 20:23:52 +0100
On Tue, 4 Oct 2022 at 20:13, Olaf van der Spek via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> On Sun, Oct 2, 2022 at 10:56 AM Kilian Henneberger via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
> >
> > Hi Olaf,
> >
> > maybe std::format_to_n is what you require?
>
> Hi,
>
> Maybe
> Maybe format_to should've deduced the size automatically.
> My point is that format_to seems to easy to misuse.
>

It would probably make sense to warn on / deprecate
`std::format_to(T(&)[N], ...)`. I think compilers should be able to do that
without any change to the Standard.

Received on 2022-10-04 19:24:06