I need advice how to insert data into map with string and set<string>. I tried something like this, but it doesnt work:
#include <map>
#include <utility>
int main()
{
std::map<string, set<string> > mymap;
std::map<string, set<string> >::iterator it = mymap.begin();
mymap.insert ( std::pair<string, set<string> > ("car" , "orange") );
return (0);
}
Could someone help me? Thank you in advance.
mymap[key] = value;? Otherwise looks like the second part of yourpairis not aset.mymap.insert({"car", {"orange"}});should work. The problem with the code in the question is that "orange" is not a set.