I want to set up a multimap
in C++ as follows:
multimap<pair<string, string>, vector<double> > mmList;
But how can I insert data into it? I tried the following code, but it doesn't compile:
mmList.insert(pair<string, string>, vector<double>("a", "b", test));
You can construct pairs using std::make_pair(a, b)
. Generally you can insert pairs into maps/multimaps. In your case you have to construct a pair consisting of the string pair and the vector:
std::multimap<std::pair<std::string, std::string>, std::vector<double> > mmList;
std::vector<double> vec;
mmList.insert(std::make_pair(std::make_pair("a","b"), vec));