> Am 21.07.2015 um 19:58 schrieb Milian Wolff <[email protected]>:
> 
> On Tuesday 21 July 2015 19:49:13 Gunnar Roth wrote:
>>>     void push_back(T &&t) {
>>> 
>>>         ensureCapacity(size() + 1);
>>>         new (m_end) T(std::move(t));                // move-construct
>>>         from t
>>>         ++m_end;
>> 
>> why is std::move needed here? Afaik std::move(t) converts t into a rvalue
>> ref, but t is already an r-value ref.
> 
> Yes, it is an r-value ref, but itself it's an lvalue. So for perfect 
> forwarding, you need to move it. Or something like that, Scott Meyers wrote a 
> chapter on that afaik but I have to admit that I forgot most of it already.
> 

I think what you mean is  std::forward 
<http://en.cppreference.com/w/cpp/utility/forward>()
Regards,
Gunnar


_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to