reserve 之后桶够不够
运行下面这段程序:
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#include <unordered_map>
int main() {
unordered_map<int, int> m;
m.reserve(100);
cout << (m.bucket_count() >= 100 ? "够了" : "不够") << endl;
}
(本题用 g++ -std=c++17 -O0 编译。)
全部评论