1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Update VecMap.hpp
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
Sandu Liviu Catalin 2020-09-06 20:11:56 +03:00
parent 6fa2ccb129
commit e7c708d997

View File

@ -54,18 +54,8 @@ template < class Key, class T, class Pred = std::equal_to< Key > > struct VecMap
{
if (e.first == key) return e.second;
}
return m_Storage.emplace_back(key, mapped_type{}).second;
}
/* --------------------------------------------------------------------------------------------
* Sub-script operator (const).
*/
const mapped_type & operator [] (const key_type & key) const
{
for (const auto & e : m_Storage)
{
if (e.first == key) return e.second;
}
return m_Storage.emplace_back(key, mapped_type{}).second;
m_Storage.emplace_back(key, mapped_type{});
return m_Storage.back().second;
}
/* --------------------------------------------------------------------------------------------
* Retrieve an iterator to the beginning. See: std::vector::begin()