Week 16 Lec 02
Week 16 Lec 02
Programming
Lecture # 28
Wednesday, June 01, 2022
Spring 2022
FAST – NUCES, Faisalabad Campus
Rizwan Ul Haq
2 Standard Template Library (STL)
Introduction to STL
Containers
Iterators
Algorithms
Function Objects
Container
v.pop_back(); v.push_back(20); …
15
11 21 5 6 11 21 5 6 20
11 21 5 6 20
v.Begin() v[3]
li.pop_back(); 15 li.push_back(20); …
11 21 5 6
11 21 5 6 20
11 …
li.pop_front();
li.push_front(9);
21 5 6 20
9 21 5 6 20
23
12
The iterator corresponding to
the class vector<int> is of the
size_ 4 type vector<int>::iterator
CS1004 - Objected Oriented Programming
18 Iterator
The member function begin() and end() return and
iterator to the first and last elements of a container
respectively
v.begin()
array_ 17
23 v.end()
12
size_ 4