[PATCH] D42357: Under limitation of allocated buffer, inplace_merge() does NOT take usage of partial allocated buffer but applies native rotate directly.

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 10:43:44 PST 2018


mclow.lists added inline comments.


================
Comment at: include/algorithm:2515
+    {
+        pointer __buff_end = __move(__first, __middle,  __buff);
+        __move(__middle, __last, __first);
----------------
mclow.lists wrote:
> Probably a good idea to qualify these calls with `_VSTD::` to ensure that no inadvertent ADL happens.
I think that you should run some tests with types that aren't `int`.

 You don't know what the state of the buffer is here; how much of it is actual objects, and how much of it is just raw memory.   For raw memory, `__move` is the wrong call, because it will attempt to "clean up" the objects that are already there.



Repository:
  rCXX libc++

https://reviews.llvm.org/D42357





More information about the cfe-commits mailing list