What is the shortest chunk of C++ you can come up with to safely clean up a std::vector or std::list of pointers? (assuming you have to call delet
std::vector
std::list
template< typename T > struct delete_ptr : public std::unary_function { bool operator()(T*pT) const { delete pT; return true; } }; std::for_each(foo_list.begin(), foo_list.end(), delete_ptr());