Chris Cain wrote:
On Thursday, 3 May 2012 at 10:03:55 UTC, Jens Mueller wrote:
What is a good solution when using member functions on a
range's/container's element?
Note, the problem only applies when storing structs because
classes
behave like references.
I think in this case, it might
Hi,
in Phobos opIndex returns a copy due to the reasons outlined in TDPL p.
378 (hiding the storage). Even though I find the argumentation
convincing and opIndexAssign/opIndexOpAssign usually makes the design
sound I ran into surprises when using member functions.
I use the Zip the range which
I don't think that opIndexAssign/opIndexOpAssign were ever a good
idea. Yeah, it works fine when all you are doing is x[i] = y, but
that doesn't scale, as you have found out. It's short-sighted.
x[i] is an L-value for arrays, so it should be for everything
else where it makes sense.
On Thursday, 3 May 2012 at 10:03:55 UTC, Jens Mueller wrote:
What is a good solution when using member functions on a
range's/container's element?
Note, the problem only applies when storing structs because
classes
behave like references.
I think in this case, it might make sense to store