On 5/22/15 1:49 AM, weaselcat wrote:
On Friday, 22 May 2015 at 05:47:28 UTC, Mike Parker wrote:
I've always used opSlice to produce empty slices, but having recently
read the documentation at [1], I see this:
"To overload a[], simply define opIndex with no parameters:"
And no mention that opSlice can fill the same role. Am I right to
infer that we should prefer opIndex over opSlice for this? If so,
what's the rationale?
[1] http://dlang.org/operatoroverloading.html#slice
http://forum.dlang.org/thread/luadir$t0g$1...@digitalmars.com#post-luadir:24t0g:241:40digitalmars.com
This is news to me, and very cool!
-Steve