[libcxx-commits] [libcxx] [libc++][ranges] optimize the performance of `ranges::starts_with` (PR #84570)
Xiaoyang Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 26 08:18:48 PDT 2024
================
@@ -69,18 +95,41 @@ struct __fn {
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr bool
operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) {
- return __mismatch::__fn::__go(
+ if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
----------------
xiaoyang-sde wrote:
A`range` can model `sized_range` when its iterators doesn't model `sized_sentinel_for`.
https://github.com/llvm/llvm-project/pull/84570
More information about the libcxx-commits
mailing list