<p>If I have the following code,</p>

<pre><code>Foo *f = new Foo();
vector&lt;Foo*&gt; vect;
vect.push_back(f);
// do stuff
vect.erase(f);
</code></pre>

<p>Did I create a memory leak? 
I guess so, but the word <em>erase</em> gives the feeling that it is deleting it. </p>

<p>Writing this, I am wondering if it is not a mistake to put a pointer in a STL vector. What do you think?</p>

Yes, you created a memory leak by that. std::vector and other containers will just remove the pointer, they won't free the memory the pointer points to.
It's not unusual to put a pointer into a standard library container. The problem, however, is that you have to keep track of deleting it when removing it from the container. A better, yet simple, way to do the above, is to use boost::shared_ptr:
```
```
{ 
    boost::shared_ptr<foo> f(new foo);

    std::vector< boost::shared_ptr<foo> > v;
    v.push_back(f);
    v.erase(v.begin());
} /* if the last copy of foo goes out of scope, the memory is automatically freed */
```
```
The next C++ standard (called C++1x and C++0x commonly) will include
```
std::shared_ptr
```
. There, you will also be able to use
```
std::unique_ptr<T>
```
which is faster, as it doesn't allow copying. Using
```
std::unique_ptr
```
with containers in c++0x is similar to the
```
ptr_container
```
library in boost.