toString refactor in druntime

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 31 22:27:14 PDT 2014


On Friday, 31 October 2014 at 22:13:31 UTC, Jakob Ovrum wrote:
> On Friday, 31 October 2014 at 19:09:28 UTC, H. S. Teoh via 
> Digitalmars-d wrote:
>> Besides, the sink version basically allows encapsulation of an 
>> output
>> range -- instead of calling x.toString(outputRange) you just 
>> write:
>>
>> 	x.toString((const(char)[] data) { outputRange.put(data); });
>
> In recent compiler versions we can just write:
>
>     x.toString(data => outputRange.put(data));

No need for the extra function, just call:

x.toString(&(outputRange.put));


More information about the Digitalmars-d mailing list