For example, all the algorithms work on regular pointers. These collections may be containers or subsets of containers. The standard template library stl hands on tutorial using. Structure of this tutorial the tutorial is divided in 6 parts and each part is divided on its turn into different sections covering a topic each one.
Not as great as a reference but is the best at introducing all the concepts necessary to grasp stl completely and good if you want to learn stl quickly. Lists are sequence containers that allow constant time insert and e. String class provides different string manipulation functions like concatenation, find, replace etc. Stl algorithms iterators and algorithms the stl algorithms are a group of functions that perform interesting operations on data that you supply.
If you want to learn c instead, check out our c tutorial c made easy, lesson 1 all lessons. C standard template library tutorial pdf formwatmo. The standard stl associative containers, set, multiset, map and multimap. These notes formed part of an internal course on the stl which i was asked to give to my colleagues at yezerski roper 1. 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. Beresford and bjarne stroustrup michaelmas term 2011 120. Java programming resources and its open source friends. The standard template library stl giving a rich set of methods manipulating data structures, etc. The standard template library tutorial cmap polytechnique. To make full use of its componentsand to benefit from their poweryou need a resource that does far more than list the classes and their functions. I briefly present the fundamental concepts in the stl, showing code examples to help you understand these concepts.
However, while you can have the same mapped values, no two key values can be the same in a single map container. 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. I will gradually replace bits of this program with stl calls. I understand that maybe you dont have enough money to buy any book. The article requires and assumes previous knowledge of the basic language features.
Take breaks when needed, and go over the examples as many times as needed. Typesafe plug compatibility between stl components. The standard stl sequence containers, vector, string, deque, and list. The maps, as the name suggests storing the values in a mapped fashion, i. Topics c cheatsheets lists c plusplus leetcode cpp stl interview codechef topcoder hackerrank coding cheatsheet codeforces interview. Strings are designed to interact well with c char arrays.
In this article, i present an introduction tutorial on the standard template library, which is the most important section of the standard library. The tutorial is also available in gzipcompressed postscript form or zipcompressed postscript form. Standard template library stl stephen clark university of cambridge heavily based on last years notes andrew moore with thanks to alastair r. Programmers familiar with the standard template library need a small, lightweight memoryaid. If you already studied the previous tutorials, you have completed the procedural or modular programming approach and then the fundamental of object oriented programming.
The stl does not make algorithms member functions of classes, but uses meta. I am using a software tool called hyperlatex to create this document. This video will teach you standard template librarys lists data structure. Thus, it is important to learn the concepts and the pitfalls of the stl to benefit from. Its small, lightweight, and chockfull of information that you can take in at a glance, so you can get on with your work. Containers store multiple elements in a single object. 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 changes. Mar 27, 2001 the stl tutorial and reference guide is highly acclaimed as the most accessible, comprehensive, and practical introduction to the standard template library stl.
Greetings there, thanks for visiting right here and thanks for visiting book website. Topics c cheatsheets lists c plusplus leetcode cpp stl interview codechef topcoder hackerrank coding cheatsheet codeforces interviewpractice hackerearth interviewpreparation interviewbit. This course is aimed at programmers who have reasonable familiarity with the. My personal experience is that the pair, the vector and the map are used more often than the other stl classes, so ill frame my discussion around them. Standard template library stl is an acronym for standard template library. You can access any section directly from the section index available on the left side bar, or begin the tutorial. A template is like a skeleton code which becomes alive when it is instantiated with a type. You can access any section directly from the section index available on the left side bar, or begin the tutorial from any point and follow the links at the bottom of each section. If you ally obsession such a referred stl tutorial and reference guide. We recommend reading this tutorial, in the sequence listed in the left menu. The various free documentation often come either as browsable web based html documents, pdf files which can be read using any of the freely available. It is not a builtin data type, but is a container class in the standard template library. The standard template library stl hands on tutorial.
778 969 857 103 1590 1134 779 1053 1237 1176 1289 1196 1725 3 1707 1327 776 489 1310 805 656 1687 965 847 312 42 1463 507 160 1111 326 1639