C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Should std::to_string be deprecated?

From: Grzegorz Sikorski <sikorski.grzegorz_at_[hidden]>
Date: Sat, 7 Oct 2023 21:15:34 +0200
Why not simplify the std::format interface with a simple overload (
https://godbolt.org/z/cfGr6v4rf)? This would solve both issues with
error-prone and cumbersome std::format("{}", 7) interface and inconsistent
function names.

On Thu, 5 Oct 2023 at 22:20, Edward Catmur via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
>
> On Thu, 5 Oct 2023 at 14:03, Giuseppe D'Angelo via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> On 05/10/2023 15:13, Jonathan Sweemer via Std-Proposals wrote:
>> > If there is a generic version of std::to_string then it should produce
>> > the same result as std::format, no?
>>
>> Which then also raises the question, is there a concept that doesn't
>> simply check that a type is formattable, but that it's formattable with
>> "{}"?
>>
>>
> Not in the standard. It could be written:
>
> std::formattable<T, char> and [](std::format_parse_context pc) {
> return std::formatter<T>().parse(pc) == pc.end();
> }(std::format_parse_context(std::string_view()))
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-10-07 19:15:47