dimanche 26 avril 2020

Adding struct to a map via make pair in c++ [closed]

I am trying to add this pair, where entiticountdto is a struct of string title, string genre, and int but I get: C++ no instance of overloaded function matches the argument list. Any ideas?

struct EntityCountDTO {
    std::string title;
    std::string genre;
    int count = 0;
};


for (const auto& m : v) {
    if (mapa.find(m.getGenre()) == mapa.end()) {
        mapa.insert(make_pair<string, EntityCountDTO>(m.getGenre(), EntityCountDTO{ m.getTitle(), m.getGenre(), 0 }));
    }
    else{
        mapa.find(m.getGenre())->second.count++;
    }
}

Aucun commentaire:

Enregistrer un commentaire