On Friday, 3 October 2014 at 01:57:37 UTC, H. S. Teoh via Digitalmars-d wrote:
The idea being that a call like `formattedWrite("%d", n)` is far more likely to be reused in other places in the program, than the specific format string "You have %d items in mailbox %s" and that specific combination of parameter types (int, string). So even though this does incur some template bloat, it will hopefully break down the template
instantiations into smaller chunks that are frequently reused.

Maybe you could do this as some kind of implicit range of "formatting references" so that you can iterate over it in two passes and save a heap allocation for situations where traversal is cheap (fits in level 1 cache):

1. first pass: collect max buffer size
2. alloca buffer on stack
3. second pass: format into buffer

?

Reply via email to