Fix small_vector insert for non-default constructible types
Summary: Instead of default constructing in `moveObjectsRight`, insert the objects directly into the hole. This has the added benefit of avoid a default construction. The creation function has to be careful to return references (rvalue, or lvalue) to avoid extra constructions without guaranteed NRVO. I've constructed the elements in reverse order since it is strange to copy backwards, then construct forwards, but don't have strong opinions, since either way is correct. Reviewed By: ot Differential Revision: D14883034 fbshipit-source-id: bc0d19bf94705718500b80e2d6c202784134e7a5
Showing
Please register or sign in to comment