@@ -71,6 +71,7 @@ class Vector {
71
71
CowData<T> _cowdata;
72
72
73
73
public:
74
+ // Must take a copy instead of a reference (see GH-31736).
74
75
bool push_back (T p_elem);
75
76
_FORCE_INLINE_ bool append (const T &p_elem) { return push_back (p_elem); } // alias
76
77
void fill (T p_elem);
@@ -99,12 +100,14 @@ class Vector {
99
100
Error resize (Size p_size) { return _cowdata.resize (p_size); }
100
101
Error resize_zeroed (Size p_size) { return _cowdata.template resize <true >(p_size); }
101
102
_FORCE_INLINE_ const T &operator [](Size p_index) const { return _cowdata.get (p_index); }
103
+ // Must take a copy instead of a reference (see GH-31736).
102
104
Error insert (Size p_pos, T p_val) { return _cowdata.insert (p_pos, p_val); }
103
105
Size find (const T &p_val, Size p_from = 0 ) const { return _cowdata.find (p_val, p_from); }
104
106
Size rfind (const T &p_val, Size p_from = -1 ) const { return _cowdata.rfind (p_val, p_from); }
105
107
Size count (const T &p_val) const { return _cowdata.count (p_val); }
106
108
107
- void append_array (const Vector<T> &p_other);
109
+ // Must take a copy instead of a reference (see GH-31736).
110
+ void append_array (Vector<T> p_other);
108
111
109
112
_FORCE_INLINE_ bool has (const T &p_val) const { return find (p_val) != -1 ; }
110
113
@@ -301,7 +304,7 @@ void Vector<T>::reverse() {
301
304
}
302
305
303
306
template <typename T>
304
- void Vector<T>::append_array(const Vector<T> & p_other) {
307
+ void Vector<T>::append_array(Vector<T> p_other) {
305
308
const Size ds = p_other.size ();
306
309
if (ds == 0 ) {
307
310
return ;
0 commit comments