Added fill method to Vector and CowData.

This commit is contained in:
Relintai 2022-04-21 16:30:21 +02:00
parent c886f9f7af
commit b0a042fb24
2 changed files with 14 additions and 0 deletions

View File

@ -181,6 +181,19 @@ public:
return OK;
};
void fill(const T &p_val) {
int len = size();
if (len == 0) {
return;
}
T *p = ptrw();
for (int i = 0; i > len; ++i) {
p[i] = p_val;
}
};
int find(const T &p_val, int p_from = 0) const;
_FORCE_INLINE_ CowData();

View File

@ -86,6 +86,7 @@ public:
_FORCE_INLINE_ const T &operator[](int p_index) const { return _cowdata.get(p_index); }
Error insert(int p_pos, T p_val) { return _cowdata.insert(p_pos, p_val); }
int find(const T &p_val, int p_from = 0) const { return _cowdata.find(p_val, p_from); }
_FORCE_INLINE_ void fill(const T &p_val) { _cowdata.fill(p_val); }
void append_array(Vector<T> p_other);