#include #include #include #include "obj.h" using namespace std; int main() { obj o1 = 10; obj o2 = 20; list li; li.push_front(&o1); li.push_back(&o2); for (list::const_iterator it = li.begin(); it != li.end(); ++it) { cout << "The obj at address " << *it << " is " << **it << ".\n"; //Can also say (**it).print() or (*it)->print() } for (list::iterator it = li.begin(); it != li.end();) { if (**it == 20) { //if ((**it).operator int() == 20) { it = li.erase(it); } else { ++it; } } for (list::const_iterator it = li.begin(); it != li.end(); ++it) { cout << **it << "\n"; } return EXIT_SUCCESS; }