[libcxx-commits] [PATCH] D131395: [libc++] Implement `lexicographical_compare_three_way`

Johel Ernesto Guerrero Peña via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 16 13:47:03 PDT 2022


JohelEGP added inline comments.


================
Comment at: libcxx/include/__algorithm/lexicographical_compare_three_way.h:46
+    }
+    return __len1 <=> __len2;
+  } else {
----------------
huixie90 wrote:
> agree with @philnik that providing benchmark to show the difference.
> 
> question: the standard specifies `return (last1 - first1) <=> (last2 - first2);` but here you are using `size_t` instead of iterator's `difference_type`. so effectively
> `return static_cast<size_t>(last1 - first1) <=> static_cast<size_t>(last2 - first2);`. Does this have an observable difference?
It should if the difference type is an integer-class type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131395



More information about the libcxx-commits mailing list