lundi 23 mai 2016

Why does std::map not have an insert function of type insert(key &k, val &v)

Why stl map not support an insert like the following:

std::map<obj1, obj2> map_int
void insert_map(obj1 &key, obj2 &val)
{
    map_int.insert(key, val);
}

I know that the above is incorrect. I want to know what prevents from designing the insert function like that. It is more intuitive than creating a pair IMO.

Aucun commentaire:

Enregistrer un commentaire