|
Boost : |
Subject: Re: [boost] C++03 unique_ptr emulation
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2009-01-08 12:52:02
On Jan 8, 2009, at 12:42 PM, Ion Gaztañaga wrote:
> is quite problematic for container implementation. With the old
> emulation (that returned detail::rv<T>) this was possible:
>
> class vector
> {
> void push_back(const value_type &);
> void push_back(boost::detail::rv<value_type>);
> }
Is it practical to do this instead?
class vector
{
void push_back(value_type x); // internally move construct from x
}
You take a performance hit on lvalue copyable expressions which are
expensive to move. But it gives you the functionality of:
class vector
{
void push_back(const value_type&);
void push_back(value_type&&);
}
And there is no hit on rvalue expressions (if I recall correctly, it
has been a little while since I did this survey).
I don't know, but from conversations with Sean, I suspect this is the
direction the Adobe move emulation took.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk