Tutorial :What is the point of STL?


I've been programming c++ for about a year now and when i'm looking about i see lots of references to STL.

Can some one please tell me what it does?

and the advantages and disadvantageous of it?

also what does it give me over the borlands VCL or MFC?



It's the C++ standard library that gives you all sorts of very useful containers, strings, algorithms to manipulate them with etc.

The term 'STL' is outdated IMHO, what used to be the STL has become a large part of the standard library for C++.

If you are doing any serious C++ development, you will need to be familiar with this library and preferably the boost library. If you are not using it already, you're probably working at the wrong level of abstraction or you're constraining yourself to a small-ish subset of C++.


STL stands for Standard Template Library. This was a library designed mainly by Stepanov and Lee which was then adopted as part of the C++ Standard Library. The term is gradually becoming meaningless, but covers these parts of the Standard Library:

  • containers (vectors, maps etc.)
  • iterators
  • algorithms

If you call yourself a C++ programmer, you should be familiar with all of these concepts, and the Standard Library implementation of them.


The STL is the Standard Template Library. Like any library it's a collection of code that makes your life easier by providing well tested, robust code for you to re-use.

  1. Need a collection (map, list, vector, etc) they're in the STL
  2. Need to operate on a collection (for_each, copy, transform, etc,) they're in the STL
  3. Need to do I/O, there's classes for that.


1, You don't have to re-implement standard containers (cus you'll get it wrong anyway)

Read this book by Nicolai M.Josuttis to learn more about the STL, it's the best STL reference book out there.


It provides common useful tools for the programmer! Iterators, algorithms, etc. Why re-invent the wheel?


"advantages and disadvantageous" compared to what? To writing all that code yourself? Is not it obvious? It has great collections and tools to work with them


Wikipedia has a good overview: http://en.wikipedia.org/wiki/Standard_Template_Library

The STL fixes one big deficiency of C++ - the lack of a standard string type. This has cause innumerable headaches as there have been thousands of string implementations that don't work well together.


It stands for standard template library

It is a set of functions and class that are there to save you a lot of work.

They are designed to use templates, which is where you define a function, but with out defining what data type it will work on.

for example, vector more or less lets you have dynamic arrays. when you create an instance of it, you say what type you want it to work for. This can even be your own data type (class).

Its a hard thing to think about, but it is hugely powerful and can save you loads of time.

Get reading up on it now! You want regret it.


It gives you another acronym to toss around at cocktail parties.

Seriously, check the intro docs starting e.g. with the Wikipedia article on STL.


The STL has Iterators. Sure, collections and stuff are useful, but the power iterators is gigantic, and, in my humble opinion, makes the rest pale in comparison.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »