C ++中的Unordered_multimap运算子=
C++函数std::unordered_multimap::operator=()通过替换旧内容,将新内容分配给unordered_multimap,并在必要时修改大小。
以下是std::unordered_map()标头中的std::unordered_multimap::operator=()函数的声明。
C++11(语法)
unordered_multimap& operator=(const unordered_multimap& umm);
参数
umm - Another unordered_multimap object of same type.
返回值
Returns this pointer.
范例程式码
#include <iostream>
#include <unordered_map>
using namespace std;
int main(void) {
unordered_multimap umm1 = {
{'a', 1},
{'b', 2},
{'c', 3},
{'d', 4},
{'e', 5},
};
unordered_multimap umm2;
umm2 = umm1;
cout << "Unordered multimap contains following elements" << endl;
for (auto it = umm2.begin(); it != umm2.end(); ++it)
cout << it->first << " = " << it->second << endl;
return 0;
}输出结果
Unordered multimap contains following elements e = 5 a = 1 b = 2 c = 3 d = 4
热门推荐
1 训练狗狗工作
4 狗狗定点排便训练
5 狗狗训练吠叫
6 狗狗尿垫训练
7 狗狗训练座
8 狗狗训练攻略
9 狗狗训练记
10 做训练狗狗
11 狗狗训练词
12 狗狗谢谢怎么训练
13 狗狗训练如厕
14 狗狗太凶怎么训练
15 狗狗训练它
16 狗狗克制训练
17 训练基地狗狗
18 怎么样训练狗狗大小硬