toString refactor in druntime

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 31 23:04:54 PDT 2014


On Saturday, 1 November 2014 at 05:27:16 UTC, Jonathan Marler 
wrote:
> No need for the extra function, just call:
>
> x.toString(&(outputRange.put));

That doesn't work for a wide variety of possible cases, notably 
when `put` is a function template or when the code depends on 
std.range.put or some other UFCS `put` function. As such, it 
should be avoided in generic code, and then you might as well 
avoid it in general, lest your algorithm unnecessarily ends up 
breaking with output ranges you didn't test for after refactoring.

(Note that parantheses are not required in your example)


More information about the Digitalmars-d mailing list