For a project i have to store several objects on a list<myType*>
I was just wondering if the member function list.pop_front will just remove my objects for the list, or totally destroy my object.
Will the member function list.pop_front eventually gonna call the destructor of my object ?
If your compiler supports it, you can use smart pointers like std::unique_ptr so they can be automatically cleaned up when they exit the list.
1 2 3 4 5 6 7 8
typedef std::unique_ptr<int> intptr;
mylist.push_back( intptr( newint(5) ) );
mylist.pop_back(); // delete is automatically called on the object. You do not have
// to do it manually