C++ Vector of pointers, add referenced variable
<p>I have a vector of pointers to an object:</p>

<pre><code>vector&lt;Foo*&gt; bar;
</code></pre>

<p>In a method, I am given an Foo object and need to add it to the vector. This is my current attempt:</p>

<pre><code>void push(const Foo &amp;a){
bar.insert(bar.begin(), a);
}
</code></pre>

<p>I know this doesnt work because <code>a</code> was passed as a reference, but I can't seem to get the pointer for <code>a</code> to add to <code>bar</code>. </p>

<p>How can I add <code>a</code> to the vector <code>bar</code>?</p>
