MCPcopy Create free account
hub / github.com/Tracktion/tracktion_engine / cmp_equal

Function cmp_equal

modules/3rd_party/magic_enum/magic_enum.hpp:344–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

enum_castFunction · 0.85
enum_flags_castFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected