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

Update VecMap.hpp

This commit is contained in:
Sandu Liviu Catalin 2021-03-04 21:59:54 +02:00
parent 66b2af9be2
commit 20cb308c3f

View File

@ -189,10 +189,10 @@ template < class Key, class T, class Pred = std::equal_to< Key > > struct VecMap
if (itr != m_Storage.end()) if (itr != m_Storage.end())
{ {
itr->second = mapped_type(std::forward< Args >(args)...); itr->second = mapped_type(std::forward< Args >(args)...);
return *itr; return itr->second;
} }
m_Storage.emplace_back(k, std::forward< Args >(args)...); m_Storage.emplace_back(k, std::forward< Args >(args)...);
return m_Storage.back(); return m_Storage.back().second;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -204,10 +204,10 @@ template < class Key, class T, class Pred = std::equal_to< Key > > struct VecMap
if (itr != m_Storage.end()) if (itr != m_Storage.end())
{ {
itr->second = mapped_type(std::forward< Args >(args)...); itr->second = mapped_type(std::forward< Args >(args)...);
return *itr; return itr->second;
} }
m_Storage.emplace_back(std::move(k), std::forward< Args >(args)...); m_Storage.emplace_back(std::move(k), std::forward< Args >(args)...);
return m_Storage.back(); return m_Storage.back().second;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------