#include <map>
#include <iostream> //pair使用头文件iostream using namespace std; int main()
{
map<int , string> myMap; pair<int , string> myPair(,"mypair"); myMap.insert(myPair);//插入 myMap.insert(pair<int,string>(,"king"));//插入 myMap.insert({,"hello"});//插入 myMap[] = "world" ;//插入 map<int,string>::iterator iter ; for(iter = myMap.begin();iter != myMap.end();iter ++)
{
cout << iter -> first << "------";
cout << iter -> second << endl;
}
} /*
1------mypair
2------king
3------hello
6------world
*/

STL map简单使用的更多相关文章

  1. 泛型Binary Search Tree实现,And和STL map比较的经营业绩

    问题叙述性说明: 1.binary search tree它是一种二进制树的.对于key值.比当前节点左孩子少大于右子. 2.binary search tree不是自平衡树.所以,当插入数据不是非常 ...

  2. C++ STL map使用

    Map是c++的一个标准容器,它提供了很好一对一的关系,在一些程序中建立一个map可以起到事半功倍的效果,总结了一些map基本简单实用的操作!1. map构造函数:map<string , in ...

  3. 详解C++ STL map 容器

    详解C++ STL map 容器 本篇随笔简单讲解一下\(C++STL\)中的\(map\)容器的使用方法和使用技巧. map容器的概念 \(map\)的英语释义是"地图",但\( ...

  4. STL map 简介

    STL map 简介 转载于:http://www.cnblogs.com/TianFang/archive/2006/12/30/607859.html 1.目录 map简介 map的功能 使用ma ...

  5. C++ STL map容器值为指针时怎么释放内存

    最近在使用STL中map时,遇到了一个问题,就是当map中值为指针对象时怎么释放内存? // 站点与TCP连接映射表 (key为ip_port_stationCode, value为 clientSo ...

  6. stl::map之const函数访问

    如何在const成员数中访问stl::map呢?例如如下代码: string ConfigFileManager::MapQueryItem(const string& name) const ...

  7. hdu4941 Magical Forest (stl map)

    2014多校7最水的题   Magical Forest Magical Forest Time Limit: 24000/12000 MS (Java/Others)    Memory Limit ...

  8. [CareerCup] 13.2 Compare Hash Table and STL Map 比较哈希表和Map

    13.2 Compare and contrast a hash table and an STL map. How is a hash table implemented? If the numbe ...

  9. STL MAP及字典树在关键字统计中的性能分析

    转载请注明出处:http://blog.csdn.net/mxway/article/details/21321541 在搜索引擎在通常会对关键字出现的次数进行统计,这篇文章分析下使用C++ STL中 ...

随机推荐

  1. iOS中 学会如何对sqlite3 进行封装 (纯手工)

    #waring ---(看官注意) ---使用说明: ①在创建自定义model类之前让该类继承自文件中的Model类, ②为model类选一个NSString属性作为主键:(既,在初始化方法里面将从父 ...

  2. linked lists in .NET

    链表是数据结构中存储数据的一种形式.分为单向链表和双向链表以及循环链表.LinkedList是泛型链表,用节点存取,节点类型为LinkedListNode<T>,每个节点都有Next和Pr ...

  3. I2S协议

    (一)I2S总线概述: 音响数据的采集.处理和传输是多媒体技术的重要组成部分.众多的数字音频系统已经进入消费市场,例如数字音频录音带.数字声音处理器.对于设备和生产厂家来说,标准化的信息传输结构可以提 ...

  4. Zabbix实战-简易教程(9)--模板

    1.模板概念 场景:比如你老板给你一个任务:有100台机器需要监控他的OS性能(CPU/内存/磁盘IO/网络),都是同样的监控项200个,上午需要添加完成,并且检查监控项的信息是否准确.这时你会怎么操 ...

  5. MQTT Server搭建(apache-apollo)和MQtt Client搭建

    目标 本文就MQTT server和client搭建做以下总结,方便测试及开发使用,能基于MQTT软件发送和接收消息. 介绍 MQTT是基于tcp的消息发送,目前JAVA方面有两种实现,分别是mqtt ...

  6. ex_gcd(个人模版)

    ex_gcd: #include<stdio.h> #include<string.h> using namespace std; int x,y; int ex_gcd(in ...

  7. Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)

    A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

  8. UVA 572 dfs求连通块

    The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSu ...

  9. NYoj_104最大和

    最大和 时间限制:1000 ms  |  内存限制:65535 KB 难度:5 描述 给定一个由整数组成二维矩阵(r*c),现在需要找出它的一个子矩阵,使得这个子矩阵内的所有元素之和最大,并把这个子矩 ...

  10. Codeforces Round #280 (Div. 2)_C. Vanya and Exams

    C. Vanya and Exams time limit per test 1 second memory limit per test 256 megabytes input standard i ...