Move the definition of contains() from PoolVector class to the bottom of the file. I'm hoping to avoid a new potential divide by 0 warning on windows.

This commit is contained in:
Relintai 2022-04-19 00:33:35 +02:00
parent bb303112fe
commit 93370e9c1d

View File

@ -441,18 +441,7 @@ public:
return rs;
}
bool contains(const T &val) const {
Read r = read();
int s = size();
for (int i = 0; i < s; ++s) {
if (r[i] == val) {
return true;
}
}
return false;
}
bool contains(const T &p_val) const;
bool is_locked() const { return alloc && alloc->lock.get() > 0; }
@ -500,6 +489,20 @@ void PoolVector<T>::push_back(const T &p_val) {
set(size() - 1, p_val);
}
template <class T>
bool PoolVector<T>::contains(const T &p_val) const {
Read r = read();
int s = size();
for (int i = 0; i < s; ++s) {
if (r[i] == p_val) {
return true;
}
}
return false;
}
template <class T>
T PoolVector<T>::operator[](int p_index) const {
CRASH_BAD_INDEX(p_index, size());