dimanche 28 juin 2020

a stack emplace a pair,but the result is not right

stack<pair<int, int>> v1;    
int x=1;                         
int y=2;
v1.emplace(x, y);           
v1.pop();
x=3;
y=4;
v1.emplace(x, y);    **second emplace,but not right,still push a {1,2}**

I use a stack of pair<int,int>,after the second time to use emplace,the pair in the stack is not {3,4},but still {1,2}. I do not now why is it wrong.

Aucun commentaire:

Enregistrer un commentaire