I've got some problem with segmentation fault while I want to remove element from vector container which is the latest one pushed in.
vector<client> :: iterator it;
for(it=ktab->begin(); it!=ktab->end(); ){
if(it->KEY_w==key_w) ktab->erase( it );
++it;
}
How to cope with this problem?
vector<client> :: iterator it;
for(it=ktab->begin(); it!=ktab->end(); ){
if(it->KEY_w==key_w) it = ktab->erase( it );
else ++it;
}
Though in such situations it is better to use member function erase with standard algorithm std::remove_it