I need to read a multimap<int,string>
from a file and i can't figure out how to do it.
ifstream in ("words.txt");
multimap<int, string> words;
int count = 0;
while (!in.eof()) {
getline(in, words[count]);
count++;
}
When i run it i get this error error: no match for ‘operator[]’ (operand types are ‘std::multimap<int, std::__cxx11::basic_string<char> >’ and ‘int’)
getline(in, words[count]);
I tried with in >> words[count]
, and it doesn't work too. How should i fix this ?