Bugfix: only test existing values in the array

This commit is contained in:
Simon Giraudot 2020-08-05 10:07:02 +02:00
parent 9ea82441c2
commit d6d189b4a1
1 changed files with 2 additions and 2 deletions

View File

@ -98,8 +98,8 @@ public:
{
if (m_size != MaxSize)
{
for (const Key& a : m_array)
if (a == key)
for (std::size_t i = 0; i < m_size; ++ i)
if (m_array[i] == key)
return false;
m_array[m_size ++] = key;
return true;