Refactored binding system for core types
Moved to a system using variadic templates, shared with CallableBind. New code is cleaner, faster and allows for much better optimization of core type functions from GDScript and GDNative. Added Variant::InternalMethod function for direct call access.
This commit is contained in:
@ -330,9 +330,8 @@ struct _ArrayVariantSort {
|
||||
}
|
||||
};
|
||||
|
||||
Array &Array::sort() {
|
||||
void Array::sort() {
|
||||
_p->array.sort_custom<_ArrayVariantSort>();
|
||||
return *this;
|
||||
}
|
||||
|
||||
struct _ArrayVariantSortCustom {
|
||||
@ -349,14 +348,13 @@ struct _ArrayVariantSortCustom {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
|
||||
ERR_FAIL_NULL_V(p_obj, *this);
|
||||
void Array::sort_custom(Object *p_obj, const StringName &p_function) {
|
||||
ERR_FAIL_NULL(p_obj);
|
||||
|
||||
SortArray<Variant, _ArrayVariantSortCustom, true> avs;
|
||||
avs.compare.obj = p_obj;
|
||||
avs.compare.func = p_function;
|
||||
avs.sort(_p->array.ptrw(), _p->array.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Array::shuffle() {
|
||||
@ -415,9 +413,8 @@ int Array::bsearch_custom(const Variant &p_value, Object *p_obj, const StringNam
|
||||
return bisect(_p->array, p_value, p_before, less);
|
||||
}
|
||||
|
||||
Array &Array::invert() {
|
||||
void Array::invert() {
|
||||
_p->array.invert();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Array::push_front(const Variant &p_value) {
|
||||
|
||||
Reference in New Issue
Block a user