Checking the documentation online I saw that it is pass by reference. Can someone confirm that the stack actually makes a copy of the data?
Checking the documentation online I saw that it is pass by reference. Can someone
Share
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.
Yes, it does copy the element you give it. In C++11, it can also move it if you give it a temporary or
std::moveinto it.Note that C++11 also offers
emplace, which directly constructs the value in-place, given constructor arguments.