[libcxx-commits] [PATCH] D59813: The other fix for equal algo

Mikhail Dvorskiy via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 26 06:55:10 PDT 2019

MikeDvorskiy marked 3 inline comments as done.
MikeDvorskiy added inline comments.

Comment at: include/pstl/internal/algorithm_impl.h:409
+equal_serial_impl(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
+                  _ForwardIterator2 __last2, _BinaryPredicate __p)
ldionne wrote:
> This can also be called as `std::equal(first1, last1, first2, last2, pred)`. Is there any reason why we don't assume the presence of the usual `std::equal`?
std::equal(first1, last1, first2, last2... 
supported since C++14...  Parallel STL open source version has min requirement  C++11.

Actually, we can add a macro __PSTL_EQUAL_ALGO_VERSION_2_PRESENT
and re-call std::equal or our own serial implementation.

Comment at: include/pstl/internal/algorithm_impl.h:426
+        [&]() { 
+            if(std::distance(__first1, __last1) != std::distance(__first2, __last2))
+                return false;
ldionne wrote:
> This is all something that the serial `std::equal` does, and I'm uncomfortable with duplicating this logic here.
Hm... I've had a look.
std::equal really does it.  So, OK, I' ll remove this duplicated logic.

Comment at: include/pstl/internal/algorithm_impl.h:466
+    if(__last1 - __first1 != __last2 - __first2)
+        return false;
ldionne wrote:
> Can you please put your changes through clang-format?
Of course 

  rPSTL pstl



More information about the libcxx-commits mailing list