August 2012
Intermediate to advanced
976 pages
30h 17m
English
vectorDirectly initializing the elements of a vector is feasible only if we have a small number of known initial values, if we want to make a copy of another vector, or if we want to initialize all the elements to the same value. More commonly, when we create a vector, we don’t know how many elements we’ll need, or we don’t know the value of those elements. Even if we do know all the values, if we have a large number of different initial element values, it can be cumbersome to specify them when we create the vector.
As one example, if we need a vector with values from 0 to 9, we can easily use list initialization. ...
Read now
Unlock full access