New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document multidimensional array op overloading #625
Conversation
Excellent! An additional point: In Can you documenti the behavior? |
What about
? |
Yes, opDollar is also evaluated at most once in each dimensions. |
Updated. Anything else? |
Nothing. Thanks! |
Document multidimensional array op overloading
There is no code example on how to integrate opIndex and opSlice, e.g. this does not work. struct Array
{
auto opIndex(size_t[2] bounds)
{
return ary[bounds[0] .. bounds[1]];
}
size_t[2] opSlice(size_t lwr, size_t upr)
{
return [lwr, upr];
}
ubyte[] ary;
} But this does. struct Array
{
auto opIndex(size_t[2] bounds)
{
return ary[bounds[0] .. bounds[1]];
}
size_t[2] opSlice(size_t dim)(size_t lwr, size_t upr)
{
return [lwr, upr];
}
ubyte[] ary;
} |
Cf. dmd pull: dlang/dmd#443