Message from C, C++ discussions

January 2020

— On 4:14, the where is the last(3rd) pointer pointing to?


At 6:27, why does the guy says that if there would be somebody holding reference then we would have a problem, What is the problem that he is talking about?

— Isn't v2 already a reference to the returned vector?

— End of allocated storage

— And what about the 2nd pointer, isn't it pointing to the same location?

— Second points to begin+size, in this case theyre same, usually they are different

— Because this somebody could suddenly start to work with moved-from object

— So, if there are actually 4 elements present in the vector and its size is 8 then the 3rd points to the 8th location and the 2nd pointer points to the 4th location?

Message permanent page

— Yes

— Size is 4, capacity is 8

— 2nd is begin+size, 3d is begin+capacity

— Ok