//*********************************************************************** void erase(HT& T, int start, int finish) { if (!T.empty()) { int s = T.size(); for (int i = start; i < s && i <= finish; ++i) { for (HT::iterator it = T.begin(); it != T.end(); ++it) if (it->second == i) { T.erase(it); break; } } for (auto &temp : T) if (temp.second >= finish) temp.second = temp.second - (finish - start) - 1; } }
/** Erases the element pointed to by the iterator. * * @param it a valid iterator to an element in cache_set. */ void erase( iterator it ) { m_ht.erase( it ); }
/** Erases all elements in a range. * * The range of elements to be deleted will be @p [first,last) * * @param first The first element in the range (included) * @param last The last element in the range (excluded) */ void erase( iterator first, iterator last ) { m_ht.erase( first, last ); }
/** Erases the element identified by the key. * * @param key The key of the item to be deleted. * * @return The number of deleted item. Since the item in cache_set are * unique, this will either be 1 when the key is found and 0 when no * item is deleted. */ size_type erase( const key_type& key ) { return m_ht.erase( key ); }