Does the acronym STL mean anything to you? No, not yet?! STL stands for Standard Template Library and no matter in which forum I am on the way or which book I read, everywhere the STL is suggested to me.

If you want to write really big programs efficiently, you can’t avoid to use libraries. After all, you don’t have to reinvent the wheel every time. That would be very cumbersome. Besides, almost every task is simplified with the use of software libraries.

And with which library do you start best? In the case of C++, of course, with the C++ Standard Library. Or the STL? Wait a minute, are these two names for the same thing? Where are the differences?

So I have no other choice. I have to deal with the STL, if only out of curiosity. This is aroused. Now I want to know what is constantly recommended to me and why.

STL - Standard Template Library

The STL was written in the early days, before C++ was standardized, by Alexander Stepanov at Hewlett Packard. What we call C++ today is written in ISO/IEC 14882:2017 (or older versions) and cannot be compared to the programming language of that time.

Quickly the STL spread and was very popular. Understandably, because it gave programmers ready-made classes and new data types, with which many basic tasks could be solved immediately.

The library is completely based on the concept of separation of data storage and data manipulation. For this purpose, the three main components Container, Iterators and Algorithms were introduced.

Container classes are used for storing data. Algorithms are responsible for manipulating data, but have no access to the data. Only Iterators can point to memory addresses of containers and allow access. So the algorithm works together with the iterator and thus indirectly manipulates the data of the container.

These components should be generic. Generic programming keeps functions and classes so general that they are not restricted to any data type. So that this is at all possible, the concept of the Templates had to be introduced.

Therefore also the name Standard Template Library. All class from this library are written as templates.

It’s time for a standard

In the 90’s there were the first efforts to unify C++ and develop it together. A world-wide standard should be defined.

A programming language does not only consist of vocabulary and grammar rules to give instructions to the computer. To the special keywords and the special syntax for the program structuring also a standard library belongs, in order to have a vollstänsigen language standard.

Because of the many advantages of the STL, under agreement of Alexander Stepanov large parts of it flowed into the first version of the C++ standard library. But in addition still some more came.

To the components belong:

  • String
  • Numerical calculations
  • Input and output
  • Error handling
  • National features
  • Memory management
  • Runtime type detection
  • Auxiliary functions
  • Standard Template Library

Even the C Standard Library belongs to the C++ Standard Library, because the compatibility to C should always be guaranteed.

So you see, the C++ Standard Library is by far more than the STL. In addition, with each new version of the ISO standard the library is extended, improved and changed. Currently, work is being done on ISO/IEC 14882:2020. In it there are more than twenty years of experience and progress compared to the first version.

However, during this period many developers and book authors have continued to use the name STL. Although they are obviously two different entities.

What’s your name?

Now we are standing there. We have two names and two libraries. Actually a suitable constellation for clear relations.

To make this confusion perfect, there are emotional discussions about whether the whole Standard Library should be called STL or only parts of it. Or whether it doesn’t matter what it is called.

One group argues that by now it is well known that today the term STL means the Standard Library. Just as everyone associates the ISO standard with C++ and none of the older versions.

Again others say that the name does not matter. As long as everyone knows what is just talked about.

Opponents of the STL name find it too confusing. People who start learning C++ today don’t know the Standrad Template Library and have to get used to this term as much as any other.

Then they encounter a library that is actually a conversion of the original STL. This lacks the additional features of the Standard Library and the inexperienced user lacks the understanding of why.

So far, it doesn’t look like an agreement will be reached anytime soon. The different camps insist on their opinions and the name chaos remains for the time being.

The Conclusion

A large part of the current C++ Standard Library has its origin from the version of the STL developed at HP. But not everything was taken over and some even differs from it. Therefore, in my opinion, the two libraries cannot be equated or the names used synonymously.

Even to designate only a subset of the C++ standard library as STL does not work. Because also taken over parts were changed with the advancement of the library.

In addition, there are other components, such as strings or streams, which were not included in the STL at that time.

In addition you will not find the term STL in the C++ ISO standard.

If you compare the two libraries, overlaps are visible, but the differences stand out very much. To ensure clear and unambiguous communication, I will henceforth retain the ISO designation C++ Standard Library.

And what do you think about this? Do you also see a term schoas or are you rather splitting hairs?

I wish you maximum success!


Sources

  • [1] U. Breymann, Der C++ Programmierer. C++ lernen – professionell anwenden – Lösungen nutzen. Aktuell zu C++17. München: Carl Hanser Verlag GmbH & Co. KG; 5. Auflage, 6. November 2017. S. 427 ff
  • [2] Standard C++ Foundation, ‘The Standard’, 2019. [Online]. Available: https://isocpp.org/std/the-standard. [Accessed: 24-Jul-2019].
  • [3] ISO, ‘ISO International Standard ISO/IEC 14882:2017(E) – Programming Language C++’, 2017. [Online]. Available: https://www.iso.org/standard/68564.html. [Accessed: 24-Jul-2019].
  • [4] A. Stevens, ‘Interview Alex Stepanov’, Dr. Dobb’s Journal, 1995. [Online]. Available: http://stepanovpapers.com/drdobbs-interview.html. [Accessed: 24-Jul-2019].
  • [5] Leibniz Universität, ‘Ergänzungen zu dem Handbuch “C++ für C-Programmierer” - C++-Standard-Library’. Hannover: Leibniz Universität. [Online]. Available: https://www.luis.uni-hannover.de/fileadmin/buecher/umdrucke/CPlus_Handbuch/standardLib_02.pdf. [Accessed: 24-Jul-2019].