C++ taking address of temporary when pushing back a pointer to a vector of pointers
<p>I am getting a warning in my code:</p>

<p>warning: taking address of temporary</p>

<p>I have seen similar questions, but they do not answer my specific problem.</p>

<p>Here is what my code is doing:</p>

<pre><code>vector&lt;A*&gt;* ex_A;

ex_A-&gt;push_back( &amp;A());  //I get this warning taking address of temporary
</code></pre>

<p>Is this undefined behavior?</p>

<p>I did have this before, which was fine, but i didn't want to worry about deleting memory from the heap.</p>

<pre><code>vector&lt;A*&gt;* ex_A;

ex_A-&gt;push_back( new A());
</code></pre>

<p>Could some one explain to me what the warning means?</p>
