#include
#include
#include
#include
#include
using namespace std;
void removeEmptyStrings(vector& strings)
{
vector::iterator it = remove_if(strings.begin(), strings.end(),mem_fun_ref(&string::empty));
// erase the removed elements
strings.erase(it, strings.end());
}
void printString(const string& str)
{
cout << str << " ";
}
int main(int argc, char** argv)
{
vector myVector;
myVector.push_back("A");
myVector.push_back("B");
myVector.push_back("C");
myVector.push_back("D");
myVector.push_back("E");
myVector.push_back("F");
removeEmptyStrings(myVector);
cout << "Size is " << myVector.size() << endl;
for_each(myVector.begin(), myVector.end(), &printString);
cout << endl;
return (0);
}