STL stands for Standard Template Library. It has been one of the most important parts of the standard library since 1999. bringing the most crucial improvements to the C++ language. It redefined the way we perceive data structures and the way we are coding right now. If you've just learned the basics of C++, then this is definitely an article that will help you gather more knowledge and progress.
Please accept my congratulations for taking the effort to improve yourself in this area of programming and for picking my article to do this. As you can probably tell from the introduction, you should have a good grasp of C++ at the very least, before you begin reading further.
However, if OOP (Object Oriented Programming) isn’t a problem for you, but you lack some good template usage/creation knowledge, don’t hesitate to read the article I also wrote on templates. A quick search on this site should reveal the location of that specific article. In order to follow along with me, it’s required that you empower yourself with the information contained in that article. If you are interested in any of the aforementioned topics, then enjoy the information that I try to share with you.
In the next few pages we’ll look at the standard library, learn its basics, and try to comprehend the idea behind it. In this first part I try to show you the basics and how a library like this is constructed. We won’t cover every corner of STL, because that would require an entire book, and besides, a very good collection of help files are already present. A help file that was created by the people that created the library itself is just a click away at the following link: the SGI site.
The first part of this article series is dedicated to some interesting history about STL and to presenting some code from the implementation file and observing how it works. The second part will go over the existing data structure in STL, along with the strengths and weaknesses of each container and its construction.
The final part is reserved for a complex STL code sample. I hope I am going to have awakened enough interest that you will follow through and research/try out some code with STL. If you think you are starting to get it, then take a look at the code snippet that implements Edgar Dijkstra's Shunting algorithm for resolving complex arithmetic expressions.
I’ll show you how to implement it using the power of STL and by being aware of the penalties a container brings in order to avoid (or minimize) a lapse in performance. We’ll also create a program that can be used effectively to calculate arithmetic expressions, or to write your own compiler just as in Visual Studio. It’s quite surprising what we can do with just a few lines of code.
But enough talk about what will be in the future. Let’s start now!