[libcxx-dev] std::vector using copy constructor on existing elements during reserve()

Michael Narigon via libcxx-dev libcxx-dev at lists.llvm.org
Tue Apr 16 10:32:23 PDT 2019

std:vector is using the element copy constructor on existing elements during its resizing operation in reserve(). I would expect it to use the move constructor for efficiency. Is this intended behavior?

This is with the libc++ delivered with Xcode 10.1.

Attached is a sample program displaying the behavior.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: application/octet-stream
Size: 3068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190416/5b8d00bc/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: output.txt
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190416/5b8d00bc/attachment.txt>

More information about the libcxx-dev mailing list