#include
#include
#include
#include
using namespace std;
int main()
{
list listObject;
list::iterator p, endp;
int i;
for(i =1; i < 20; i++)
listObject.push_back(i);
cout << "Original sequence:\n";
p = listObject.begin();
while(p != listObject.end()) {
cout << *p << " ";
p++;
}
cout << endl;
endp = remove_if(listObject.begin(), listObject.end(), bind2nd(greater(), 8));
cout << "Resulting sequence:\n";
p = listObject.begin();
while(p != endp) {
cout << *p << " ";
p++;
}
return 0;
}