mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-03 18:09:13 +03:00
Merge pull request #1711 from BenLubar/vector-bsearch-const
Make Vector<T>::bsearch use a const receiver
This commit is contained in:
@@ -124,14 +124,14 @@ public:
|
|||||||
sorter.sort(data, len);
|
sorter.sort(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size bsearch(const T &p_value, bool p_before) {
|
Size bsearch(const T &p_value, bool p_before) const {
|
||||||
return bsearch_custom<_DefaultComparator<T>>(p_value, p_before);
|
return bsearch_custom<_DefaultComparator<T>>(p_value, p_before);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Comparator, typename Value, typename... Args>
|
template <typename Comparator, typename Value, typename... Args>
|
||||||
Size bsearch_custom(const Value &p_value, bool p_before, Args &&...args) {
|
Size bsearch_custom(const Value &p_value, bool p_before, Args &&...args) const {
|
||||||
SearchArray<T, Comparator> search{ args... };
|
SearchArray<T, Comparator> search{ args... };
|
||||||
return search.bisect(ptrw(), size(), p_value, p_before);
|
return search.bisect(ptr(), size(), p_value, p_before);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<T> duplicate() {
|
Vector<T> duplicate() {
|
||||||
|
|||||||
Reference in New Issue
Block a user