vendredi 29 juillet 2016

Issues with map

I do have below struct defined

struct WayStruct{
    double ID;
    string Neighbours;
};

and below map

map <double,WayStruct> WayMap;

To add a new element to this map I use

WaysFind.ID=999;
WaysFind.Neighbours="test";
WayMap.insert(1234,WaysFind);

However I can not get this compiled. Dev-C++ end in error with

[Error] no matching function for call to 'std::map<double, WayStruct>::insert(double, WayStruct&)' 

Can someone tell what I'm doing wrong here?

Aucun commentaire:

Enregistrer un commentaire