C++中unordered_map的基本用法

#include
using namespace std;
#include
using namespace std::tr1;
//这样写才能编译通过,同时不影响原来的功能如cin,cout 

void test01()
{
	//声明格式如下 
	unordered_mapumap;
	//插入元素的三种方式 
	umap.insert(pair("apple",2));
	umap.insert(unordered_map::value_type("orange",3));
	umap["banana"] = 6;
	//判断表是否为空 
	if(!umap.empty())
	{
	//表不为空则输出表内元素个数 
		cout<<"表内元素个数为:"<

你可能感兴趣的:(数据结构与算法,c++,开发语言,算法)