示例#1
0
void erase_if (container& c, pred op)
{
    for (auto i (std::begin(c)); i != std::end(c);)
    {
        if (op(*i))
            i = c.erase(i);
        else
            ++i;
    }
}
void insert(container& c, int key, int val)
{
	auto itr = c.insert(make_pair(key,val));
	if(!itr.second)
	{
		cout << "re-insert " << "[" << key << "," << val << "]" << "!!!" << endl;
#if 0
		c.erase(itr.first);
		c.insert(make_pair(key,val));
#else
		itr.first->second = val;
#endif
	}
}