The Algorithm Design Manual
About the Book
Programming Challenges

The Stony Brook Algorithm Repository

Steven Skiena
Stony Brook University
Dept. of Computer Science

Standard Template library in C++ form SGI


The Standard Template Library, or STL, is a C++ library of container classes, algorithms, and iterators; it provides many of the basic algorithms and data structures of computer science. The STL is a generic library, meaning that its components are heavily parameterized: almost every component in the STL is a template. You should make sure that you understand how templates work in C++ before you use the STL.

The STL include several other types of components.
First, the STL includes several utilities: very basic concepts and functions that are used in many different parts of the library. The concept Assignable, for example, describes types that have assignment operators and copy constructors; almost all STL classes are models of Assignable, and almost all STL algorithms require their arguments to be models of Assignable.

Second, the STL includes some low-level mechanisms for allocating and deallocating memory. Allocators are very specialized, and you can safely ignore them for almost all purposes.

Finally, the STL includes a large collection of function objects, also known as functors. Just as iterators are a generalization of pointers, function objects are a generalization of functions: a function object is anything that you can call using the ordinary function call syntax. There are several different concepts relating to function objects, including Unary Function (a function object that takes a single argument, i.e. one that is called as f(x)) and Binary Function (a function object that takes two arguments, i.e. one that is called as f(x, y)). Function objects are an important part of generic programming because they allow abstraction not only over the types of objects, but also over the operations that are being performed.


  • Download Files (local site)
  • SQI site of STL

    Recommended Books

    Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library by S. Meyers STL Tutorial and Reference Guide: C++ Programming with the Standard Template Library by D. Musser and G. Derge and A. Saini

    Problem Links

      
    Dictionaries (10)
      
    Generating Permutations (10)
      
    Median and Selection (10)
      
    Priority Queues (10)
      
    Searching (10)
      
    Set Data Structures (10)
      
    Sorting (10)



    This page last modified on 2008-07-10 .
    www.algorist.com