On Tue, Jul 21, 2015 at 12:49 PM Gunnar Roth <gunnar.r...@gmx.de> 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.
>

The rule of thumb is if you can get the address of the object, then it is
an l-value. It may be an r-value going into the function but once in the
function, you can get its address. You need to use std::move to treat data
as an r-value again.
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to