| 390 | |
| 391 | template <typename BinaryPredicate> |
| 392 | constexpr bool cmp_equal(string_view lhs, string_view rhs, [[maybe_unused]] BinaryPredicate&& p) noexcept(is_nothrow_invocable_v<BinaryPredicate>) { |
| 393 | #if defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) |
| 394 | // https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html |
| 395 | // https://developercommunity.visualstudio.com/content/problem/232218/c-constexpr-string-view.html |
| 396 | constexpr bool workaround = true; |
| 397 | #else |
| 398 | constexpr bool workaround = false; |
| 399 | #endif |
| 400 | |
| 401 | if constexpr (!is_default_predicate_v<BinaryPredicate> || workaround) { |
| 402 | if (lhs.size() != rhs.size()) { |
| 403 | return false; |
| 404 | } |
| 405 | |
| 406 | const auto size = lhs.size(); |
| 407 | for (std::size_t i = 0; i < size; ++i) { |
| 408 | if (!p(lhs[i], rhs[i])) { |
| 409 | return false; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | return true; |
| 414 | } else { |
| 415 | return lhs == rhs; |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | template <typename L, typename R> |
| 420 | constexpr bool cmp_less(L lhs, R rhs) noexcept { |
no test coverage detected