this as lvalue?

Jonathan M Davis jmdavisprog at gmail.com
Sat Sep 4 01:49:50 PDT 2010


On Saturday 04 September 2010 01:32:03 KennyTM~ wrote:
> On Sep 4, 10 05:22, Andrei Alexandrescu wrote:
> > On 9/3/10 16:03 CDT, bearophile wrote:
> >> JMRyan:
> >>> Is this a bug in the compiler (v.2.047)? Am I missing something in
> >>> thinking it shouldn't be?
> >> 
> >> I think it's not a bug. It's not a common need, but a method may way
> >> want to swap this with another. In Phobos this is done on a struct, see:
> >> http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d#
> >> L324
> >> 
> >> 
> >> Bye,
> >> bearophile
> > 
> > For classes this must be an rvalue.
> > 
> > Andrei
> 
> If 'this' is an rvalue then it is not possible to take the address
> ('&this').

And of what possible use would taking the address of an object reference be?

- Jonathan M Davis


More information about the Digitalmars-d mailing list