[Development] QVector now has rvalue push_back (was: Re: HEADS UP: potential trouble from a recent QVector change)

Keith Gardner kreios4004 at gmail.com
Mon Jul 20 20:25:43 CEST 2015


On Mon, Jul 20, 2015 at 1:11 PM Thiago Macieira <thiago.macieira at intel.com>
wrote:

> On Monday 20 July 2015 14:06:33 Marc Mutz wrote:
> > https://codereview.qt-project.org/121810
> >
> > So start using qMove() or pass temporaries in your QVector::append()
> calls.
>
> What's the difference in std::vector between an rvalue push_back and
> emplace_back?
>

emplace_back takes variadic template arguments to construct the item
directly in the vector instead of creating a temporary and then performing
a move operation. If the template argument is just an rvalue of the
container type, it will perform just like the rvalue push_back function.

http://en.cppreference.com/w/cpp/container/vector/emplace_back
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150720/c4db94a6/attachment.html>


More information about the Development mailing list