[PATCH] D27068: Improve string::find

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 2 10:36:14 PST 2016


mclow.lists added a comment.

This is starting to look good.



================
Comment at: libcxx/include/__string:549
+    // Stop short when source is smaller than pattern.
+    ptrdiff_t __len2 = __last2 - __first2;
+    if (__len2 == 0)
----------------
Is there a reason that you calculate the end pointer(s) from `first + len` in the calling function, then recover the length here?

Also, `__len1` and `__len2` should be const.


https://reviews.llvm.org/D27068





More information about the cfe-commits mailing list