Range returning an array
bearophile
bearophileHUGS at lycos.com
Tue Apr 9 13:59:57 PDT 2013
Ali Çehreli:
> Your problem is the exact situation that stdio.ByLine has
> faced. There, the choice has been to use an internal buffer
> just like your 'var' and leave the .dup call to the user for
> when it is needed.
>
> That choice is faster but sometimes causes bugs.
In similar situations I add a boolean template argument that
switches on or off the dupping of the given result. On default
it's on. So it's safe on default and faster on request, and this
goes well with the D zen.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list