| 696 | } |
| 697 | |
| 698 | bool Array::all(const Callable &p_callable) const { |
| 699 | const Variant *argptrs[1]; |
| 700 | for (int i = 0; i < size(); i++) { |
| 701 | argptrs[0] = &get(i); |
| 702 | |
| 703 | Variant result; |
| 704 | Callable::CallError ce; |
| 705 | p_callable.callp(argptrs, 1, result, ce); |
| 706 | if (ce.error != Callable::CallError::CALL_OK) { |
| 707 | ERR_FAIL_V_MSG(false, vformat("Error calling method from 'all': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); |
| 708 | } |
| 709 | |
| 710 | if (!(result.operator bool())) { |
| 711 | // Return as early as possible when one of the inverted conditions is `false`. |
| 712 | // This improves performance compared to relying on `filter(...).size() >= array_size().`. |
| 713 | return false; |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | return true; |
| 718 | } |
| 719 | |
| 720 | struct _ArrayVariantSort { |
| 721 | _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const { |
no test coverage detected