3 ms·
Your point rather misses the mark. Your vector<int*> is a red herring. The distinction I'm making is between passing a (vector<int>)* and a vector<int>, becau
by klyrs 2y ago
Your point rather misses the mark.
Your vector<int*> is a red herring. The distinction I'm making is between passing a (vector<int>)* and a vector<int>, because those two objects have radically different sizes, and the distinction can and does create severe performance issues. And yet, pointers are still different from references: with a reference, you don't even need your object to have a memory address.
- tsimionescu 2y agoHN markup ate my *... Yes, I'm also talking about vector<int> and vector<int>*. They are indeed of radically different sizes, and the consequences of copying one are very different from the consequences of copying the other. But this doesn't change the fact that they are both passed-by-value when you call a function of that parameter type.