3 Topics
|
|
I have delared two multimaps such as; multimap<int,vector<int>> allpathsmap; multimap<int,vector<int>>:: iterator itapm; typedef pair<int,vector<int>> pairapm; multimap<int,vector<int>> graphtextmap; multimap<int,vector<int>>:: iterator itgtm; typedef pair<int,vector<int>> pairgtm; And I wrote the following code to traverse the values of multimaps to print the key; for(itgtm=graphtextmap.begin(); itgtm!=graphtextmap.end(); ++itgtm) { for(itapm=allpathsmap.begin(); itapm!=allpathsmap.end(); ++itapm) { cout << endl … |
|
#include<iostream> #include<string> #include<vector> #include<set> #include<map> using namespace std; struct PoiDetails { int x; std::string s; }; int main() { struct PoiDetails oBj; std::map<std::string, PoiDetails> vName; oBj.x = 1; oBj.s = "str1"; vName["Jhon"] = oBj; oBj.x = 2; oBj.s = "str2"; vName["Ben F"] = oBj; oBj.x = 3; oBj.s = "str3"; … |
|
Hi everyone again :) Bit of a weird problem, but is there any way of counting how many keys are stored within a multimap? Say for example I have the keys A, B, C and D. Each of these keys have say 100 values for each, so there should be … |
The End.