lundi 29 juin 2015

map.count not working properly

for (auto f : s) {
    cout << m.count(f) << endl;
    if (m.count(f))
    {
        cout << "worked";
        myfile << f << ": " << m[f] << "\n";
    }
}

This code checks to see if a word's in the map, then outputs the word and the definition to a text file, called myfile. However, it never shows as finding the words in the map! The map appears to be populated correctly, as I've tested with outputting the map's contents. Any ideas?

Aucun commentaire:

Enregistrer un commentaire