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.
C can't have an "exact equivalent" of STL because C doesn't have templates or classes.
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.
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.
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.
Two books come to mind: Josuttis's The C++ Standard Library (and his page for it), and Meyers's Effective STL
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With