diff --git a/pretext/CollectionData/Vectors.ptx b/pretext/CollectionData/Vectors.ptx index e72e62b..80b4b88 100644 --- a/pretext/CollectionData/Vectors.ptx +++ b/pretext/CollectionData/Vectors.ptx @@ -1,6 +1,7 @@
Vectors -

Vectors are much more similar to Python lists than arrays are. + +

Vectors are much more similar to Python lists than arrays are. Vectors use a dynamically allocated array to store their elements, so they can change size, and they have other friendly features as well. Because they use a dynamically allocated array, they use contiguous storage locations @@ -141,7 +142,8 @@ as we see in the next example. Because vectors can change size, vectors typically allocate some extra storage to accommodate for possible growth. Thus the vector typically has an actual capacity greater than the storage size strictly needed to contain its elements.

- + + Iterating through Vectors

When iterating vectors, you must first find the length of your container. You can simply call the .length() function. For arrays, the number of elements can be found by getting the size in memory of the array @@ -433,5 +435,4 @@ main() -

- + \ No newline at end of file