Boost logo

Boost :

Subject: Re: [boost] Temporary objects
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-10-30 05:57:36

DE wrote:
> unfortunately i'm totally out of time now
> so i only write my proposal and an example
> forgive me for that

Now you will have to forgive us our cryptic answers. And I assume that you are somewhat familiar with copy elision, return value optimization, rvalues and some move-emulation libraries and move-support proposals (rvalue references).

> template<typename type>
> class temporary : public type

This is actually an interesting semantic. I just checked and found that the proposed Boost.Move library also uses the same semantics (move.hpp:72-73:
template <class T>
class rv : public T
), but the older Adobe Move library doesn't use it, and the semantics of the proposed rvalue-reference is also different from this.

What I like about this semantics is that for

class A {...};
class B : public A {...};

the type "temporary<B>&" cannot implicitly be converted to "temporary<A>&". For the proposed rvalue-reference, the type "B&&" can implicitly be converted to "A&&", and I have the impression that this can lead to behavior even worse than slicing.


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