std::map erase all element in C++

Started by
1 comment, last by gohkgohk 16 years, 1 month ago
Do i need to use a for loop to erase all element in std::map? this looks quite slow... Can i erase all the element at one time? for (map<...>::iterator i = mymap.begin(); i != mymap.end(); i++) { mymap.erase(i); } Thx
Advertisement
std::map<T>::clear. See also std::map<T>.
Quote:Original post by ToohrVyk
std::map<T>::clear. See also std::map<T>
.

Thx so much:)

This topic is closed to new replies.

Advertisement