SpiecsEngine
 
Loading...
Searching...
No Matches

◆ erase()

template<typename K , typename V >
void scl::linked_unordered_map< K, V >::erase ( const K & key)
inline

Remove a element inside the container if founded by key.

Parameters
[in]keyK the key.

Definition at line 227 of file LinkedUnorderedMap.h.

228 {
229 std::unique_lock<std::shared_mutex> lock(m_Mutex);
230
231 auto it = m_Map.find(key);
232 if (it != m_Map.end())
233 {
234 m_Keys.remove(key);
235 m_Map.erase(it);
236
237 --m_Size;
238 }
239 }
std::shared_mutex m_Mutex
Mutex for this container.
std::unordered_map< K, V > m_Map
std::list< K > m_Keys
The container keeps iter in order.
std::atomic_int m_Size
This container size.