I am getting a warning in my code:
warning: taking address of temporary
I have seen similar questions, but they do not answer my specific problem.
Here is what my code is doing:
vector<A*>* ex_A;
ex_A->push_back( &A()); //I get this warning taking address of temporary
Is this undefined behavior?
I did have this before, which was fine, but i didn't want to worry about deleting memory from the heap.
vector<A*>* ex_A;
ex_A->push_back( new A());
Could some one explain to me what the warning means?