<p>What is the shortest chunk of C++ you can come up with to safely clean up a <code>std::vector</code> or <code>std::list</code> of pointers?  (assuming you have to call delete on the pointers?)</p>
<pre><code>list&lt;Foo*&gt; foo_list;
</code></pre>
<p>I'd rather not use Boost or wrap my pointers with smart pointers.</p>

```
```
template< typename T >
struct delete_ptr : public std::unary_function<T,bool>
{
   bool operator()(T*pT) const { delete pT; return true; }
};

std::for_each(foo_list.begin(), foo_list.end(), delete_ptr<Foo>());
```
```