m[k] 悄悄插了一条
运行下面这段程序:
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#include <unordered_map>
int main() {
unordered_map<int, int> m;
m[7] = 1;
if (m[5] == 0) {
// 只是想看看 5 在不在
}
cout << m.size() << "/" << m.count(9) << endl;
}
(本题用 g++ -std=c++17 -O0 编译。)
全部评论