Solved

Prior to C++11 the Following Code Created a Temporary String

Question 30

Multiple Choice

Prior to C++11 the following code created a temporary string object and passed it to push_back, which then copied it into the vector: vector<string> myVector;
MyVector.push_back("message") ;
As of C++11, member function push_back is now overloaded with a version that takes a(n) ________. This allows the preceding call to push_back to take the storage allocated for the temporary string and reuse it directly for the new element in the vector. The temporary string will be destroyed when the function returns, so there's no need for it to keep its content.


A) const pointer
B) rvalue reference
C) rvalue pointer
D) const reference

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents