Taking address of properties

FG home at fgda.pl
Thu Feb 7 10:43:20 PST 2013


On 2013-02-07 19:05, Robert wrote:
> taking the address of the ref return value of a property is of no
> value at all. If you want someone to be able to take the address
> of a field, you should make it simply public (without @property),
> because the @property accessor methods won't gain you anything in
> this case.

Once again. Ref returns are commonly used in ranges.
I'd say that being able to take address of someRange.front is good for
example for interoperability with external C libraries.
Temporarily using a pointer here should be fine.


> Having said this, I think the solution to the & operator is pretty
> straight forward, it takes the address of the accessor function [...]
> Tada. Problem solved :-)

Didn't solve the one mentioned above.
So either I am wrong, you are wrong or range.front shouldn't be a @property?


More information about the Digitalmars-d mailing list