| 359 | }; |
| 360 | |
| 361 | constexpr std::size_t find(string_view str, char_type c) noexcept { |
| 362 | #if defined(__clang__) && __clang_major__ < 9 && defined(__GLIBCXX__) || defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) |
| 363 | // https://stackoverflow.com/questions/56484834/constexpr-stdstring-viewfind-last-of-doesnt-work-on-clang-8-with-libstdc |
| 364 | // https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html |
| 365 | constexpr bool workaround = true; |
| 366 | #else |
| 367 | constexpr bool workaround = false; |
| 368 | #endif |
| 369 | |
| 370 | if constexpr (workaround) { |
| 371 | for (std::size_t i = 0; i < str.size(); ++i) { |
| 372 | if (str[i] == c) { |
| 373 | return i; |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | return string_view::npos; |
| 378 | } else { |
| 379 | return str.find(c); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | template <typename BinaryPredicate> |
| 384 | inline constexpr bool is_default_predicate_v = std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<string_view::value_type>> || std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<>>; |
no test coverage detected