Skip to content

Commit 4d83361

Browse files
committed
make Vector<T>::bsearch use a const receiver
1 parent 93d2706 commit 4d83361

11 files changed

+13
-13
lines changed

core/templates/vector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ class Vector {
127127
sorter.sort(data, len);
128128
}
129129

130-
Size bsearch(const T &p_value, bool p_before) {
130+
Size bsearch(const T &p_value, bool p_before) const {
131131
return bsearch_custom<_DefaultComparator<T>>(p_value, p_before);
132132
}
133133

134134
template <typename Comparator, typename Value, typename... Args>
135-
Size bsearch_custom(const Value &p_value, bool p_before, Args &&...args) {
135+
Size bsearch_custom(const Value &p_value, bool p_before, Args &&...args) const {
136136
SearchArray<T, Comparator> search{ args... };
137-
return search.bisect(ptrw(), size(), p_value, p_before);
137+
return search.bisect(ptr(), size(), p_value, p_before);
138138
}
139139

140140
Vector<T> duplicate() {

doc/classes/PackedByteArray.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
Appends a [PackedByteArray] at the end of this array.
4848
</description>
4949
</method>
50-
<method name="bsearch">
50+
<method name="bsearch" qualifiers="const">
5151
<return type="int" />
5252
<param index="0" name="value" type="int" />
5353
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedColorArray.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
Appends a [PackedColorArray] at the end of this array.
5252
</description>
5353
</method>
54-
<method name="bsearch">
54+
<method name="bsearch" qualifiers="const">
5555
<return type="int" />
5656
<param index="0" name="value" type="Color" />
5757
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedFloat32Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
Appends a [PackedFloat32Array] at the end of this array.
4848
</description>
4949
</method>
50-
<method name="bsearch">
50+
<method name="bsearch" qualifiers="const">
5151
<return type="int" />
5252
<param index="0" name="value" type="float" />
5353
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedFloat64Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Appends a [PackedFloat64Array] at the end of this array.
4949
</description>
5050
</method>
51-
<method name="bsearch">
51+
<method name="bsearch" qualifiers="const">
5252
<return type="int" />
5353
<param index="0" name="value" type="float" />
5454
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedInt32Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
Appends a [PackedInt32Array] at the end of this array.
4848
</description>
4949
</method>
50-
<method name="bsearch">
50+
<method name="bsearch" qualifiers="const">
5151
<return type="int" />
5252
<param index="0" name="value" type="int" />
5353
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedInt64Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Appends a [PackedInt64Array] at the end of this array.
4949
</description>
5050
</method>
51-
<method name="bsearch">
51+
<method name="bsearch" qualifiers="const">
5252
<return type="int" />
5353
<param index="0" name="value" type="int" />
5454
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedStringArray.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
Appends a [PackedStringArray] at the end of this array.
5555
</description>
5656
</method>
57-
<method name="bsearch">
57+
<method name="bsearch" qualifiers="const">
5858
<return type="int" />
5959
<param index="0" name="value" type="String" />
6060
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedVector2Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
Appends a [PackedVector2Array] at the end of this array.
5353
</description>
5454
</method>
55-
<method name="bsearch">
55+
<method name="bsearch" qualifiers="const">
5656
<return type="int" />
5757
<param index="0" name="value" type="Vector2" />
5858
<param index="1" name="before" type="bool" default="true" />

doc/classes/PackedVector3Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
Appends a [PackedVector3Array] at the end of this array.
5252
</description>
5353
</method>
54-
<method name="bsearch">
54+
<method name="bsearch" qualifiers="const">
5555
<return type="int" />
5656
<param index="0" name="value" type="Vector3" />
5757
<param index="1" name="before" type="bool" default="true" />

0 commit comments

Comments
 (0)