Boost logo

Boost :

Subject: Re: [boost] [move][container] Review Request (new versions of Boost.Move and Boost.Container in sandbox and vault)
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2009-08-28 03:55:14

Ion Gaztañaga wrote:
> Jeffrey Hellrung escribió:
>> Ion,
>> With your current move-emulation approach, it looks like functions
>> like vector::push_back could actually capture genuine rvalues, similar
>> to how operator= does, via BOOST_COPY_ASSIGN_REF( T ) for movable
>> types T (and using const T& for nonmovable types). For example:
> Yes, I know that, but I had no time to update containers to take
> advantage of this feature. I'll try to do it before the review, I think
> you need 3 overloads for C++03 systems:
> //const T & for C++0x, const boost::rv<T> & for C++03
> push_back(BOOST_COPY_ASSIGN_REF(value_type)v);
> //T && for C++0x, boost::rv<T> & for C++03
> push_back(BOOST_RV_REF( T ) value);
> push_back(value_type & v)
> { push_back(const_cast<const value_type &>(v); }
> #endif
> However, I haven't found a way to generalize it for perfect forwarding
> (emplace, emplace_back) because the template parameters must be deduced
> from arguments and that does not work as push_back. I need help from
> more talented people ;-)
> Best,
> Ion

Great, just making sure that was on the table ;) Also, surely you mean

#ifndef BOOST_HAS_RVALUE_REFS // rather than #ifdef

? I could be confused...

As far as generic forwarding, I've been playing around with it a little
and I'm likewise stuck on how to capture true rvalues via template
parameter deduction :/

- Jeff

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