cppreference.com says that complexity of range erase of std::map is:
log(c.size()) + std::distance(first, last)
while erase for single element by iterator is amortized constant. So if I erase elements in a loop:
for( auto it = first; it != last; it = map.erase( it ) );
that should be linear on std::distance(first, last), and cplusplus.com agrees with that. What does standard say? Is this just typo on cppreference.com?
Aucun commentaire:
Enregistrer un commentaire