Date: Sun, 14 May 2023 17:30:16 +0200
std::cout.put(65) writes "A"
So not compatible.
puts("65") expects a pointer and writes "65\n"
For print and println ostream-members have been created in addition to free std::print and std::println, and it would make sense for such an autodetecting function.
puts has string in its name and would be illogical to auto-detect other types. One can reason it would convert to string.
Would it be safe and continue to work with any current use?
-----Ursprüngliche Nachricht-----
Von:Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:So 14.05.2023 15:39
Betreff:Re: [std-proposals] D2879R0 Proposal of Pythonesque std::print extensions LIVE LINK
An:Andrew Tomazos <andrewtomazos_at_[hidden]>;
CC:Ville Voutilainen <ville.voutilainen_at_[hidden]>; std-proposals_at_[hidden];
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.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2023-05-14 15:30:19