Using arrays with functions taking ranges
Mu
invalid_email at address.int
Fri Dec 14 07:59:47 PST 2012
> It works because "put" is defined for all input ranges as
> "write to first element and popFront".
That makes more sense, thanks.
So what happens is that for "regular" ranges std.range.put() gets
used, while for arrays in RefAppender std.array.put() gets used,
right?
(I noticed that the unittest fails if the destination char[]
isn't empty.)
> The "problem" in this case is that you have to make sure
> *before hand*, that there is enough room to do this. If you
> were to "accidently" stuff into your input range more than it
> can take, you'll error out. EG. the same as going past it_end.
I think it's OK. The output MmFile is constructed to have the
size of the input MmFile. So their opSlice's will have the same
length.
More information about the Digitalmars-d-learn
mailing list