updating README again

This commit is contained in:
Jidong Xiao
2023-09-01 13:13:35 -04:00
parent c29bb2adb5
commit 33a1df5684

View File

@@ -103,7 +103,6 @@ std::vector<int> e( b );
The following outlines rules for passing vectors as parameters. The same rules apply to passing strings. The following outlines rules for passing vectors as parameters. The same rules apply to passing strings.
- If you are passing a vector as a parameter to a function and you want to make a (permanent) change to the - If you are passing a vector as a parameter to a function and you want to make a (permanent) change to the
vector, then you should pass it by reference. vector, then you should pass it by reference.
This is very different from the behavior of arrays as parameters.
- What if you dont want to make changes to the vector or dont want these changes to be permanent? - What if you dont want to make changes to the vector or dont want these changes to be permanent?
The answer weve learned so far is to pass by value. The answer weve learned so far is to pass by value.
The problem is that the entire vector is copied when this happens! Depending on the size of the vector, The problem is that the entire vector is copied when this happens! Depending on the size of the vector,