//erase an element in a list
//Combine erase and remove to remove a found element
#include
#include
#include
#include
#include
using namespace std;
int main( ) {
list lstStr;
lstStr.push_back("A");
lstStr.push_back("B");
lstStr.push_back("C");
lstStr.push_back("D");
lstStr.push_back("E");
list::iterator p;
p = find(lstStr.begin( ), lstStr.end( ), "C");
p = lstStr.erase(p);
lstStr.erase(remove(lstStr.begin( ), lstStr.end( ), "D"),lstStr.end( ));
}