vector<X> v;
X x;
v.push_back(x); v.push_back(x); v.push_back(x);
Why this code calls the copy constructor of a class X
6 times? (using g++ 4.7.2 STL)
Please, I'd like to know it precisely what happens under hood with this particular STL.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…