[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
Mon Jan 22 09:39:29 PST 2018
mclow.lists added inline comments.
================
Comment at: include/algorithm:2511
+ difference_type __len1, __len2;
+ __len1 = __middle - __first;
+ __len2 = __last - __middle;
----------------
These iterator calculations only work for random access iterators.
Does this actually work with forward iterators?
================
Comment at: include/algorithm:2515
+ {
+ pointer __buff_end = __move(__first, __middle, __buff);
+ __move(__middle, __last, __first);
----------------
Probably a good idea to qualify these calls with `_VSTD::` to ensure that no inadvertent ADL happens.
================
Comment at: include/algorithm:4582
+ //__middle = _VSTD::rotate(__m1, __middle, __m2);
+ __middle = _VSTD::__buffered_rotate(__m1, __middle, __m2, __buff, __buff_size);
// __len12 and __len21 now have swapped meanings
----------------
It seems a shame to calculate `__len1`, etc on L#2511 above when you have them right here.
Repository:
rCXX libc++
https://reviews.llvm.org/D42357
More information about the cfe-commits
mailing list