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 PopBack();
void Remove(size_type); void Remove(size_type);
bool Has(const T&) const;
const T& operator[](size_type) const; const T& operator[](size_type) const;
T& operator[](size_type); T& operator[](size_type);
@ -106,6 +108,15 @@ namespace BAN
m_size--; 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> template<typename T>
const T& Vector<T>::operator[](size_type index) const const T& Vector<T>::operator[](size_type index) const
{ {