Using arrays with functions taking ranges

bearophile bearophileHUGS at
Thu Dec 13 12:47:23 PST 2012


> Then how can I approach this to work for both cases:
> 1) output is empty?
> 2) output is the size of input? (MmFile's)

You have to tell those cases apart with a run time test, so your 
output range should support empty, or even length. If you want to 
overwrite the already allocated space, then I think you need the 
output range to be assignable, or to have items usable by ref. 
Other people should be able to give you a better answer.


More information about the Digitalmars-d-learn mailing list