[libcxx-commits] [PATCH] D113868: [libcxx] Cast to the right `difference_type` in `std::search` and `std::find_end`

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 15 09:36:22 PST 2021


Mordante added a comment.

I also miss tests. In general when fixing a bug it would be nice to add tests based on the reported error.
In this case best follow @Quuxplusone's suggestion for the tests.



================
Comment at: libcxx/include/__algorithm/find_end.h:101
   // Take advantage of knowing source and pattern lengths.  Stop short when source is smaller than pattern
-  typename iterator_traits<_RandomAccessIterator2>::difference_type __len2 = __last2 - __first2;
+  const _D2 __len2 = __last2 - __first2;
   if (__len2 == 0)
----------------
Style nit: in general we don't use `const` variables in libc++.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113868/new/

https://reviews.llvm.org/D113868



More information about the libcxx-commits mailing list