MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / cmp_equal

Function cmp_equal

include/behaviortree_cpp/contrib/magic_enum.hpp:343–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341
342template <typename BinaryPredicate>
343constexpr 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
370template <typename L, typename R>
371constexpr bool cmp_less(L lhs, R rhs) noexcept {

Callers 1

enum_castFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected