set的erase函数

#include "stdafx.h"
#include
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	set st;
	st.insert(1);
	st.insert(1);
	st.insert(2);
	st.insert(3);
	st.erase(1);//直接删除
	st.erase(st.find(3));//找到删除 区间这里不做表达
	for(set::iterator it=st.begin();it!=st.end();it++)
	{
		printf(" %d\n ",*it);
	}
	return 0;
}

set的erase函数_第1张图片

你可能感兴趣的:(set的erase函数)