I have a little question about a code example in C++.
vector<Cat> v;
Cat c;
v.push_back(c);
Cat d = v[0];
In this piece of code, how many objects are created?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
At least three:
Edit: Note that I only count
Catobjects here, because it doesn’t make sense to ask how many objects in total are created, because that would be implementation specific (how isstd::vectorimplemented? What doesCatdo? …)