Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem solving in C++ with STL

Tags:

c++

stl

I am preparing for a programming competition in witch we solve programming problems in c++.

Looking at the former year solutions, they seem quite easy (not more than ~30 lines of code). I realised that they are widely using the STL for easy manipulating - vectors, sets, maps, lists and also the algorithms available in STL.

Any site for beginners like me who want to learn the features of STL and its use in solving problems ?

Thank you in advance.

like image 954
gujo Avatar asked Sep 12 '09 17:09

gujo


People also ask

Can STL be used in C?

C can't have an "exact equivalent" of STL because C doesn't have templates or classes.

Is STL used in DSA?

you can learn DSA with STL easily from geeksforgeeks. if you use STL then implement of DSA are easy and efficient. example:sort fuction,binary_search function,vector,map,set,pair,etc.

What is an STL algorithm?

The Standard Template Library, or STL, is a C++ library of container classes, algorithms, and iterators; it provides many of the basic algorithms and data structures of computer science. The STL is a generic library, meaning that its components are heavily parameterized: almost every component in the STL is a template.

What is the difference between STL and STD?

The STL contains sequence containers and associative containers. Containers are objects that store data. The standard sequence containers include vector, deque, and list. The standard associative containers are set, multiset, map, multimap, hash_set, hash_map, hash_multiset, and hash_multimap.


3 Answers

Two books come to mind: Josuttis's The C++ Standard Library (and his page for it), and Meyers's Effective STL

like image 137
Phil Miller Avatar answered Oct 02 '22 01:10

Phil Miller


As well as Scott Meyer's excellent book "Effective STL" which has been recommended above, I can't recommend highly enough the excellent book Accelerated C++ by Andrew Koenig and Barbara E. Moo.

The book starts by having you use STL very early in the book explaining their uses in the context of initially simple problems. This book treats C++ as its own language and not as C with bits bolted on, the mechanics of defining a class aren't explained until later in the book.

like image 24
Rob Wells Avatar answered Oct 02 '22 01:10

Rob Wells


If you have some conception of non-STL C++ and specifically need to understand how STL's approaches correspond to non-STL ones, I recommend this tutorial.

like image 38
Alex Martelli Avatar answered Oct 02 '22 01:10

Alex Martelli