I had a bad time with slice-in-struct array operation forwarding/mimicing. What's the best way to do it?
Random D user
no at email.com
Thu May 9 20:22:25 UTC 2019
On Saturday, 4 May 2019 at 16:10:36 UTC, Adam D. Ruppe wrote:
> On Saturday, 4 May 2019 at 15:18:58 UTC, Random D user wrote:
>> But array copy and setting/clearing doesn't:
>> int[] bar = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
>> 14, 15 ];
>> foo[] = bar[];
> Generally speaking, opIndex is for getting, opIndexAssign is
> for setting.
Thanks a lot for a very detailed answer. Sorry about the late
reply.
> But for 2d and 3d and more arrays, the number of functions
> explodes really fast.
Yeah, tastes like C++, but I guess I'll bite.
I value debuggability and I only have the 2D case, so I think
templates are out.
More information about the Digitalmars-d-learn
mailing list