| 341 | |
| 342 | template <typename BinaryPredicate> |
| 343 | constexpr bool cmp_equal(string_view lhs, string_view rhs, [[maybe_unused]] BinaryPredicate&& p) noexcept(is_nothrow_invocable<BinaryPredicate>()) { |
| 344 | #if defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) |
| 345 | // https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html |
| 346 | // https://developercommunity.visualstudio.com/content/problem/232218/c-constexpr-string-view.html |
| 347 | constexpr bool workaround = true; |
| 348 | #else |
| 349 | constexpr bool workaround = false; |
| 350 | #endif |
| 351 | |
| 352 | if constexpr (!is_default_predicate<BinaryPredicate>() || workaround) { |
| 353 | if (lhs.size() != rhs.size()) { |
| 354 | return false; |
| 355 | } |
| 356 | |
| 357 | const auto size = lhs.size(); |
| 358 | for (std::size_t i = 0; i < size; ++i) { |
| 359 | if (!p(lhs[i], rhs[i])) { |
| 360 | return false; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | return true; |
| 365 | } else { |
| 366 | return lhs == rhs; |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | template <typename L, typename R> |
| 371 | constexpr bool cmp_less(L lhs, R rhs) noexcept { |