Lazy formatting

Vladimir Panteleev thecybershadow.lists at
Mon Feb 1 15:28:02 UTC 2021

On Monday, 1 February 2021 at 00:25:42 UTC, Steven Schveighoffer 
> I have often wanted a lazy formatting feature where you aren't 
> allocating but it returns a string-able thing that can be used 
> as an input range. I was surprised that phobos doesn't provide 
> this.
> Would be really awesome to have, but I think possibly it means 
> we need to reengineer the lower level. Probably a phobos 2.0 
> thing.

Um, do you mean something like this?

assert(64.formatted!"%x".text == "40");

It's not an input range (I think emitting formatted strings as an 
input range without an intermediary buffer would be impractically 
difficult in general), but it does use the sink toString 

More information about the Digitalmars-d mailing list