Add to Technorati Favorites

Standard Template Library (STL)

  • Going by the name, Standard means part of standard C++, Template means the classes and functions contained in the STL are generic and in C++ terms they are template classes or template functions, and Library means collection of these classes and functions.
  • Originally, STL was conceived by HP and now supported by almost all C++ compilers that support ISO/ANSI C++.
  • STL contains 3 things:
- Container: May be sequential like list and vector. Or, associative like map and set
- Iterator: For accessing elements of a container. May be forward only, bi-directional, random access, output iterators and input iterators.
- Algorithms: To perform functions on elements contained in a container. Examples are: find, merge, sort etc.

Points to Ponder
  • STL Algorithms are generic and not member function or friend function of any class. So these algorithms can be used with non STL containers also like you can use sort() for C++ arrays.
  • Although, STL is quite useful, efficient, and robust but your compiler may report some warnings etc. which can be handled easily like turning off warnings, not using pre-compiled headers etc.
Interested readers can either request me a complete tutorial on STL by emailing me at:
Or, wait for detailed post later.

No comments: