vector Member Function size; Function outputVector

Line 18 uses vector member function size to obtain the size (i.e., the number of elements) of integers1. Line 20 passes integers1 to function outputVector (lines 96–102), which uses a range-based for statement to obtain the value in each element of the vector for output. As with class template array, you can also do this using a counter-controlled loop and the subscript ([]) operator. Lines 23 and 25 perform the same tasks for integers2.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.