20160804-CPP-map
来源:互联网 发布:js实现倒计时 编辑:程序博客网 时间:2024/05/21 07:04
map def: Constructs a list of a specific size or with elements of a specific value or with a specific allocator or as a copy of some other map.
1、map之间可以用 = 或者 ! = 来比较两个map之间是否相等, multimap也可以用。
map和multimap的区别
http://blog.csdn.net/cws1214/article/details/8211881
2、multimap <int, int> m1, m2, m3;
3、map之间也可以用<=, <, >=, >
The less-than relationship between two objects is based on a comparison of the first pair of unequal elements.
4、swap( m1, m3 )
Exchanges the elements of two maps or multimaps.
关键的私有值
一个是key,用key来索引data value
有用的成员函数
5、at的使用
map<char, int> Mymap;
Mymap c1;
c1.insert(value_type('a', 1));
cout << "c1.at('a') == " << c1.at('a') <<endl;
6、begin()的使用
Returns an iterator that points to the first element in the map.
7、find()的使用
template <typename C, class T> void findit(const C& c, T val) { cout << "Trying find() on value " << val << endl; auto result = c.find(val); if (result != c.end()) { cout << "Element found: "; print_elem(*result); cout << endl; } else { cout << "Element not found." << endl; }}8、max_size()
max_size
Returns the maximum length of the map.
9. size()
size
Returns the number of elements in the map.
10、[ ]
// Insert a data value of 10 with a key of 1 // into a map using the operator[] member function m1[ 1 ] = 10;
0 0
- 20160804-CPP-map
- cpp的STL之map
- NDK-CPP语言-queue队列+stack栈+list+set+map
- cpp
- CPP
- CPP
- cpp
- cpp
- CPP
- CPP
- .*的用处(.dll .aps .clw .dsp .DSW .plg .hpj .map .pch .pdb .exp .ncb .opt .dll .cpp .h)
- ClientSockThread.cpp&&ClientUrlThread.cpp
- cpp调用其他cpp
- map
- MAP
- map
- MAP
- map
- 使用命令进行文件操作
- 剑指Offer:栈的压入、弹出序列
- 旋转卡壳
- 问题:console.log()的用法
- linux安装jdk
- 20160804-CPP-map
- OpenJDK 1.8的安装,build Android N
- Databinding使用在XML中使用&&
- js校验表单插件
- python pow()和math.pow()函数
- 标签解析和JavaScript的闭包
- linux 下网络设备
- Android 7.0 的改动(持续更新)
- 百度2017暑期实习生编程题单词接龙