Alias this with array can only be used once
Blake Anderton
rbanderton at gmail.com
Wed Feb 22 15:16:00 PST 2012
Thanks all for the quick replies.
You're right- I am mixing the container with the range to ill
effect. I'm just doing this for practice so I'm not tied to any
one solution, but I was trying to make the container work as much
like a built-in type as possible. With an array the above tests
work (I assume because each operation is implicitly a new slice?).
I found I can fix the above example by aliasing a function that
returns a slice of the member array instead of aliasing the field
itself, but that may still be too close a relationship of the
container/range. My instinct (which could be completely wrong) is
that it's fine since the container is taking responsibility for
creating valid ranges, it is just doing so implicitly.
User code having to explicitly take ranges (either through
opSlice or a property/method) isn't a terrible thing, but it
would be convenient to not have to take that extra step.
More information about the Digitalmars-d-learn
mailing list