Re: non-const reference to temporary (was: non-const copy ctor)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrew,

Andrew Haley wrote:
> [...]
> I can.  "The initializer of a const T& need not be an lvalue..."  In
> other words, although he doesn't explicitly say so, the initializer of
> a const T& has to be an lvalue.

Yes, I guessed so as well. But what's the reason for this decision?

>
>  > I understand that it generally doesn't make sense to alter a
>  > temporary object. But why forbid it?
>
> Because, semantically speaking, it makes no sense.

Yes, mostly. And that this is forbidden imposes a problem in the rare cases 
where it does make sense. And in those cases where someone does not want to 
use const at all (like me).

Thanks,
  Christian

>
> But we're way off topic now.
>
> Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux