How to modify an element in a range/collection using its member function?

Chris Cain clcain at uncg.edu
Thu May 3 05:16:43 PDT 2012


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 pointers to 
structs.

So,

auto c = R!(Point*)(10);

OR

alias Point* PointRef;
auto c = R!PointRef(10);


Let me know if there's something wrong with this approach.


More information about the Digitalmars-d mailing list