Question OOP-CTOR-0079
HardWhy does std::vector<T>::emplace_back avoid a temporary compared with push_back(T(args))?
- A.
It skips the constructor
- B.
It is the same
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Constructors and Destructors question
Why does std::vector<T>::emplace_back avoid a temporary compared with push_back(T(args))?
It skips the constructor
It is the same
Sign up free to see the answer and a step-by-step explanation.
It constructs the element directly in the vector's storage from the arguments
It copies twice