C++ Logo

std-proposals

Advanced search

Re: Fwd: Internal fill *not* considered harmful (re: P1652)

From: Zhihao Yuan <zy_at_[hidden]>
Date: Tue, 25 Jun 2019 20:03:54 +0000
On Tuesday, June 25, 2019 2:25 PM, Matthew Woehlke via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> How does one readily achieve this?
>
> std::string s1 = std::format("{: =6}", 42); // s1 == "+ 42"
> std::string s2 = std::format("{: =6}", -5); // s2 == "- 5"
>
> That was my first assumption as to why one would want to use internal
> alignment in the first place...
>

I think you meant "{:=+6}". I'm
sure that any feature can be found
to have some use if you derive its
behavior from specification, the
question is whether it worth the
effort. Let's say we specified '='
as an alignment that is "compatible"
with the '0' flag as you suggests,
can someone quickly tell the
difference between {:0=6}, {:=06},
{:0=06}, and {:06}?

On the other hand, our proposed
wording is forward-compatible with
adding '=' as you suggest (correct
me if I'm wrong). If people are
motivated they can add it. But
Rust people seem not :)

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2019-06-25 15:05:50