C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D2879R0 Proposal of Pythonesque std::print extensions LIVE LINK

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sun, 14 May 2023 16:38:40 +0300
On Sun, 14 May 2023 at 16:13, Andrew Tomazos <andrewtomazos_at_[hidden]> wrote:
>
> Sebastian Wittmeier wrote:
>>
>> > std::put used
>
>
> Where is std::put used in the existing standard library?

Nowhere, but there's a
https://en.cppreference.com/w/cpp/io/basic_ostream/put which almost
matches the intent here, because
it's an unformatted output function.


> So I was thinking we could propose that:
>
> std::put(1,2,3);
>
> is equivalent to:
>
> std::println("{} {} {}", 1, 2, 3);
>
> and forget about all the other forms.

ostream::put doesn't put a newline, whereas this function would. I
don't find that a consistent API.

Received on 2023-05-14 13:38:53