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