Boost logo

Boost :

From: Gennadiy Rozental (gennadiy_at_[hidden])
Date: 2002-10-01 03:19:40

> Difficult but I'll try. Rvalues of non-class types don't have addresses as
> they can live outside the addressable memory (in registers, for example.)
> When a reference is bound to an rvalue, that rvalue may need to be copied
> addressable memory. In a context where 'this' is not used, rvalues of
> types can live outside addressable memory, too.

Does this mean that if 'this' IS used than compiler is not allowed to put
rvalues of class types outside addressable memory?

> So the compiler in the above is allowed to use the copy constructor to
> create another (addressable) temporary of type 'A' (or 'A const') and bind
> the reference to it, instead of binding directly to 'A()' that may not be
> addressable.
Continue my question: does the following should compile?

class A {
    A() {};
    int field;
    A( A const& );
    void operator=( A const& );

void foo( A const& a )
    int i = a.field;

void moo()
    foo( A() );


Boost list run by bdawes at, gregod at, cpdaniel at, john at