2
나는 우리가 배치 한 모든 값을 볼 수 있는지보고 싶습니다. 예를 들어 :정렬되지 않은 멀티 맵은 모든 값을 찾습니다.
는#include <iostream>
#include <unordered_map>
using namespace std;
int main() {
unordered_multimap<string,int> hash;
hash.emplace("Hello", 12);
hash.emplace("World", 22);
hash.emplace("Wofh", 25);
for (int i = 1; i < 10; i++) {
hash.emplace("Wofh", i);
}
cout << "Hello " << hash.find("Hello")->second << endl;
cout << "Wofh " << hash.count("Wofh") << endl;
cout << "Wofh " << hash.find("Wofh")->second << endl;
return 0;
}
출력은 다음과 같습니다
$ ./stlhash
Hello 12
Wofh 10
Wofh 9
나는 마지막 줄은 분명히 find
만 first
및 second
포인터 등의 소요 (9)에 ... 25,1,2에서 보여주고 싶은 반면 첫 번째는 값이고 두 번째는 해당 값입니다. 이 일을 할 수있는 방법이 있습니까?
가능한 중복 http://stackoverflow.com/questions/9046922/ c-unordered-multimap) – nimcap