BAN: Vector now has a Has() function

This commit is contained in:
Bananymous 2022-12-20 11:38:29 +02:00
parent 4c559f50a4
commit 7ae00ac76e
1 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,8 @@ namespace BAN
void PopBack();
void Remove(size_type);
bool Has(const T&) const;
const T& operator[](size_type) const;
T& operator[](size_type);
@ -105,6 +107,15 @@ namespace BAN
memmove(m_data + index, m_data + index + 1, (m_size - index - 1) * sizeof(T));
m_size--;
}
template<typename T>
bool Vector<T>::Has(const T& other) const
{
for (size_type i = 0; i < m_size; i++)
if (m_data[i] == other)
return true;
return false;
}
template<typename T>
const T& Vector<T>::operator[](size_type index) const