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

Reply via email to