示例#1
0
		static void				Delete( CSocket& sock ){
			CSession* pSession = Find( sock );
			if( pSession ){
				m_Sessions.erase( sock.GetHandle() );
				delete pSession;
			}
		}
void update(MAP & p , pii x){
	
	MAP::iterator it = p.lower_bound(x.F), ini = it;
	if( it != p.end() && it->F == x.F && it->S <= x.S) return;
	if( it != p.begin() && (--it)->S <= x.S) return;
	it = ini;
	while( it != p.end() && it->S >= x.S) it++;
	p.erase( ini, it);
	p[x.F] = x.S;
}
int main()
{
	typedef map<string, int> MAP;
	MAP removal;
	string removal_word = "Anna";
	removal.insert(MAP::value_type(removal_word, 47)); 
 	if (removal.erase(removal_word))
 		cout << "Ok," << removal_word << " removed" << endl;
	else
		cout << "oops" <<removal_word << "not found!" <<endl;
	
	return 0;
}