On Friday, 20 November 2015 at 18:48:51 UTC, Alex Parrill wrote:
On Friday, 20 November 2015 at 18:23:57 UTC, HaraldZealot wrote:

I'm not sure how useful this is as opposed to plain pointers. For structs, since `foo.bar` is the same as `(&foo).bar`, you may as well use a pointer, and the only thing it saves for numbers is a pointer deference or two.

I realized that for my initial purposes simple pointer simply work, but when I'm trying make as possible universal template as it can be, I discover that the main problem with direct operators (and this touches not only numbers).


You say ranges are pass-by-value, but that's not entirely true. Ranges themselves can be classes, or be made references via std.range.refRange. Range elements can be made lvalues by using ref functions [1].

Possible refRange is what I was looking for. Thanks.


As for the code:

* Your example usage (x = x += x = (x * 5)) is confusing, due to the chained assignments.

This is special one of boundary cases, that clarify why is it so complicated to create full-functional wrapper.




Reply via email to