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 2020-09-06 05:03:37 +03:00
parent b3a56eac12
commit 35d93e16dc

View File

@ -160,16 +160,16 @@ template < class Key, class T, class Pred = std::equal_to< Key > > struct VecMap
[&](const_reference e) -> bool { return e.first == key; }); [&](const_reference e) -> bool { return e.first == key; });
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* * Check if an element with a specific key exists in the container.
*/ */
// Check if an element with a specific key exists in the container.
bool exists(const key_type & key) const noexcept { return find(key) != m_Storage.cend(); } bool exists(const key_type & key) const noexcept { return find(key) != m_Storage.cend(); }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Append a new element to the end of the container. * Append a new element to the end of the container.
*/ */
template< class... Args > mapped_type & emplace_back( Args&&... args ) template< class... Args > mapped_type & emplace_back( Args&&... args )
{ {
return m_Storage.emplace_back(std::forward< Args >(args)...).second; m_Storage.emplace_back(std::forward< Args >(args)...);
return m_Storage.back().second;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Remove the last element of the container. * Remove the last element of the container.