Property change problem

Koroskin Denis 2korden at gmail.com
Mon Jul 21 10:38:34 PDT 2008


On Mon, 21 Jul 2008 21:26:04 +0400, Jarrett Billingsley  
<kb3ctd2 at yahoo.com> wrote:

> "Zarathustra" <adam.chrapkowski at gmail.com> wrote in message
> news:g62dv7$gao$1 at digitalmars.com...
>
>>  l_bar.foo.u.a = 5;   // no effect
>
> I really wish the compiler could catch stuff like this.  It has no effect
> because it's doing something like this:
>
> auto temp = l_bar.foo.u;
> temp.a = 5;
>
> And then throwing away 'temp'.  That is, it's not modifying l_bar.foo.u,
> it's modifying a temporary copy of it.
>
> It would work if u() returned an SSome* (that is, "return &this.m_u;"),  
> but
> I don't know if that's acceptable for you.
>
>

That's why we need C++-style references!


More information about the Digitalmars-d-learn mailing list