From 54f8fb010c28ac0ce594a53a61ebdb8a645ce1db Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Fri, 20 Jan 2023 20:18:56 +0100 Subject: Sync C# Array with Core - Add `AddRange` method. - Add `Fill` method. - Add `Max` and `Min` methods. - Add `PickRandom` method. - Add `Reverse` method. - Add `RecursiveEqual` method. - Add `Sort` method. - Add `Slice` and `GetSliceRange` methods. - Add `IndexOf` overload that takes an index parameter. - Add `LastIndexOf` method. - Add `BinarySearch` method. - Add/update documentation. --- core/variant/array.cpp | 4 ++-- core/variant/array.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'core/variant') diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 94d1596514..c38af726bd 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -612,14 +612,14 @@ void Array::shuffle() { } } -int Array::bsearch(const Variant &p_value, bool p_before) { +int Array::bsearch(const Variant &p_value, bool p_before) const { Variant value = p_value; ERR_FAIL_COND_V(!_p->typed.validate(value, "binary search"), -1); SearchArray avs; return avs.bisect(_p->array.ptrw(), _p->array.size(), value, p_before); } -int Array::bsearch_custom(const Variant &p_value, const Callable &p_callable, bool p_before) { +int Array::bsearch_custom(const Variant &p_value, const Callable &p_callable, bool p_before) const { Variant value = p_value; ERR_FAIL_COND_V(!_p->typed.validate(value, "custom binary search"), -1); diff --git a/core/variant/array.h b/core/variant/array.h index d9ca3278fb..7b30e57de3 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -84,8 +84,8 @@ public: void sort(); void sort_custom(const Callable &p_callable); void shuffle(); - int bsearch(const Variant &p_value, bool p_before = true); - int bsearch_custom(const Variant &p_value, const Callable &p_callable, bool p_before = true); + int bsearch(const Variant &p_value, bool p_before = true) const; + int bsearch_custom(const Variant &p_value, const Callable &p_callable, bool p_before = true) const; void reverse(); int find(const Variant &p_value, int p_from = 0) const; -- cgit v1.2.3