Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///
- T[2] opIndex(size_t idx) pure
- {
- assert(idx < length);
- Coords coords = coordsInSquare(idx);
- import std.traits;
- static assert(isMutable!(typeof(coords))); // ok
- if(coords.x <= coords.y) // under diagonal line?
- {
- auto latestIdx = srcLength - 1;
- // Mirroring coords
- coords.x = latestIdx - coords.x; // Error: cannot modify const expression coords.x
- coords.y = latestIdx - coords.y - 1;
- }
- return [coords.x, coords.y];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement