File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -83,18 +83,23 @@ std::vector<int> v;
8383// General Operations
8484// ---------------------------------
8585
86+ // Size
87+ unsigned int size = v.size();
88+
8689// Insert head, index, tail
8790v.insert(v.begin(), value); // head
8891v.insert(v.begin() + index, value); // index
8992v.push_back(value); // tail
9093
9194// Access head, index, tail
9295int head = v.front(); // head
96+ head = v[0 ]; // or using array style indexing
97+
9398int value = v.at(index); // index
94- int tail = v.back() ; // tail
99+ value = v[index] ; // or using array style indexing
95100
96- // Size
97- unsigned int size = v.size();
101+ int tail = v.back(); // tail
102+ tail = v[v .size()- 1 ]; // or using array style indexing
98103
99104// Iterate
100105for (std::vector<int >::iterator it = v.begin(); it != v.end(); it++) {
You can’t perform that action at this time.
0 commit comments