Stndard Template Library

Páginas: 11 (2669 palabras) Publicado: 27 de mayo de 2012
The Standard Template Library Tutorial
184.437 Wahlfachpraktikum (10.0)

Johannes Weidl

Information Systems Institute Distributed Systems Department Technical University Vienna

Advisor Professor

Dipl. Ing. Georg Trausmuth DI Dr. Mehdi Jazayeri

Friday, 26. April 1996

"The Standard Template Library (STL) is a C++ programming library that has been developed by Alexander Stepanovand Meng Lee at the Hewlett Packard laboratories in Palo Alto, California. It was designed to enable a C++ programmer to do generic programming and is based on the extensive use of templates - also called parametrized types. This paper tries to give a comprehensive and complete survey on the STL programming paradigm and shall serve as step-by-step tutorial for the STL newcomer, who hasfundamental knowledge in C++ and the object-oriented paradigm."

Table of contents
1 Introduction______________________________________________________________ 4 2 C++ basics _______________________________________________________________ 4
2.1 Classes_______________________________________________________________________ 4 2.2 Functionobjects_______________________________________________________________ 8 2.3 Templates ____________________________________________________________________ 8
2.3.1 Function templates __________________________________________________________________ 9 2.3.2 Class templates ____________________________________________________________________ 10 2.3.3 Template member functions __________________________________________________________ 10 2.3.4 Templatespecialization______________________________________________________________ 10

3 A STL overview __________________________________________________________ 12
3.1 STL availability and information________________________________________________ 13
3.1.1 FTP-Sites_________________________________________________________________________ 13 3.1.2 URLs____________________________________________________________________________ 13

3.2 What does STL consist of? _____________________________________________________ 14 3.3 Compiling STL programs ______________________________________________________ 15
3.3.1 Borland C++ 4.0 DOS-programs ______________________________________________________ 15 3.3.2 Borland C++ 4.0 WINDOWS-programs_________________________________________________ 16 3.3.3Borland C++ 4.5 DOS- and WINDOWS-programs ________________________________________ 17

4 Learning STL ___________________________________________________________ 18
4.1 Containers __________________________________________________________________ 18
4.1.1 Vector ___________________________________________________________________________ 18 4.1.2 Exercises_________________________________________________________________________ 26

4.2 Iterators ____________________________________________________________________ 27
4.2.1 Input Iterators and Output Iterators _____________________________________________________ 28 4.2.2 Forward Iterators___________________________________________________________________ 31 4.2.3 Bidirectional Iterators_______________________________________________________________ 32 4.2.4 Random Access Iterators_____________________________________________________________ 33 4.2.5 Exercises _________________________________________________________________________ 34

4.3 Algorithms and Function Objects _______________________________________________ 34
4.3.1 How to create a generic algorithm______________________________________________________ 344.3.2 The STL algorithms ________________________________________________________________ 37 4.3.3 Exercises _________________________________________________________________________ 42

4.4 Adaptors ____________________________________________________________________ 42
4.4.1 Container Adaptors _________________________________________________________________ 43 4.4.2 Iterator Adaptors...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Library
  • Template
  • template
  • Our Library
  • Metal library
  • Library Cience
  • Swot Template
  • Anova Template

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS