On Nov 22, 10 04:49, spir wrote:
On Sun, 21 Nov 2010 17:28:09 +0100 Pelle Månsson<[email protected]> wrote:However, writeln can do this: foreach (arg; args) { arg.writeTo((const(char)[] data) { outputbuffer.put(data); }) } thereby removing the need to store the string, and the extra allocations. This design is much cleaner than the current strategy, and also more flexible.(Sorry for the irony.) "Make simple things easy." Have to write a delegate to get feedback... to print a bit of text. (What is "hello, world!" in D?) Denis -- -- -- -- -- -- -- vit esse estrany ☣ spir.wikidot.com
Can't detect irony, captain. *You* don't need to write a delegate to get the string. That lower-level facility should have been packed up in the standard library function to!string which you don't need to care. All you need is to call the simple and easy function to!string(x) 1000 times if you want to waste 1000 memory allocations to get 1000 copy of strings.
