Simplifies your life if, for example, functions return complicated. A modest stl tutorial by jak kirman i am using a software tool called hyperlatex to create this document. Standard template library and the java collections classes. For example, one might use an iterator to step through the elements. The tutorial is also available in compressed postscript form. It is a library of container classes, algorithms, and iterators. All the classes, that are part of stl can be divided in four categories. An introduction to the standard template library stl the stl vector container.
These functions perform essential services such as input and output and provide efficient implementations of frequently used operations. For instance, you can use the stl vector container to store a vector think of it as a resizable array of any object you desire. The spirit of the standard template library is the idea of generic programming the implementation of algorithms or data structures without being dependent on the type of data being handled. This allows a function or class to work on many different data types without being rewritten for. In programming container is an abstract data type adt which represents a collection of other objects. This library consists of a lot of useful components. In this article, i present an introductiontutorial on the standard template library, which is the most important section of the standard library. Tutorial basic use configuring via template parameters querying container attributes point and range iteration examples intermediate use. Lavavej, microsofts keeper of the stl cloth this means he manages the partnershi. For those wanting to install a copy of these pages on their system, they may be freely copied providing they are not modified in any significant way other than, say, locale. This was standardized by the ansi committee prior to acceptance by the iso c standard c. For highlevel applications it is relatively rare to build your own linked list, hash table, binary search tree, etc.
The standard template library stl giving a rich set of methods manipulating data structures, etc. It is a generalized library and so, its components are parameterized. They are implemented as class templates, which allows a great flexibility in the types supported as elements. I briefly present the fundamental concepts in the stl, showing code examples to help you understand these concepts. Stl list container understanding floating point numbers. There are different template instantiation techniques, for example manual. Fill a vector with values read from standard input. The book provides comprehensive documentation of each library component, including an introduction to its purpose and design. Most of the times, it has been felt that the readers, who are using the ebooks for first time, happen to have a demanding time before getting used to. Alexander stepanov, designer of the standard template library says. Using command options headers header files mixing headers.