

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The standard template library (stl) is a powerful collection of data structures and algorithms added to the c++ standard library. An overview of stl, its components, and benefits. It includes examples of using stl vectors, deques, lists, sets, multisets, maps, and multimaps.
Typology: Slides
1 / 25
This page cannot be seen from the preview
Don't miss anything!


















#include
int main() {
std::vector< int > iv; int x, y; char ch; do { cout<<"Enter the first integer:"; cin >> x; cout<<"Enter the second integer:"; cin >> y;
Enter the first integer: 1
Enter the second integer: 2
Current capacity of iv = 2
Current size of iv = 2
Do you want to continue? y
Enter the first integer: 3
Enter the second integer: 4
Current capacity of iv = 4
Current size of iv = 4
Do you want to continue? y
#include
int main() {
std::deque< int > dq; dq.push_front( 3 ); dq.push_back( 5 );
dq.pop_front(); dq.pop_back() return 0;
}
#include
int main() {
std::list< float > _list; _list.push_back( 7.8 ); _list.push_back( 8.9 ); std::list< float >::iterator it = _list.begin(); _list.insert( ++it, 5.3 ); return 0;
}
#include
int main() {
std::set< char > cs; cout << “Size before insertions: “ << cs.size() << endl; cs.insert( ‘a’ ); cs.insert( ‘b' ); cs.insert( ‘b' ); cout << “Size after insertions: ” << cs.size(); return 0;
} Docsity.com
#include
int main() {
std::multiset< char > cms; cout << "Size before insertions: " << cms.size() << endl; cms.insert( 'a' ); cms.insert( 'b' ); cms.insert( 'b' ); cout << "Size after insertions: " << cms.size(); return 0;
} Docsity.com
Size before insertions: 0
Size after insertions: 3