unordered_map增删改案列

增删改案列

#include 
#include 
using namespace std;
typedef unsigned int TrieKey;
typedef unordered_map NextMap;
typedef pair TreeNode;
int main() {
	NextMap *tree = new NextMap();
	tree->insert(make_pair(999, 1));
	tree->insert(make_pair(999, 2));
	tree->insert(make_pair(999, 3));
	tree->insert(make_pair(9991, 4));
	NextMap::iterator a = tree->find(999);
	if (tree->end() != a) {
		a->second = 55;
	}
	tree->insert(make_pair(999, 4));
	cout << tree->find(999)->second << endl;

	tree->erase(9991);

	if (tree->find(9991) == tree->end()) {
		cout << "不存在" << 9991 << endl;
	}

	system("pause");
	return 0;
}

转载于:https://my.oschina.net/colin86/blog/3099623

你可能感兴趣的:(unordered_map增删改案列)