This would be another example of the adage that for C when they saw a gap they just wrote more code, for {insert other languaage, C++ generally but these days you see it a lot} when they saw a gap they added syntax. While I do think it could've been designed in a better way, it at least made some kind of sense given that it's just doubling the symbol used for references. But I still wish they had gone with the @ symbol.
@neelneelify
Жыл бұрын
If I do a second push, e.g, like the following, my_vector.push_back(std::move(p1)); my_vector.push_back(std::move(p2)); why do I see a copy constructor running in the end?
@CoffeeBeforeArch
Жыл бұрын
The vector probably needed to allocate space to hold more than one element, and had to copy the first element to the newly allocated space
@neelneelify
Жыл бұрын
@@CoffeeBeforeArch I see. Thank you for the response! Your videos are amazing btw! Thanks for making them.
Пікірлер: 4