cppannotations/yo/stl/intro.yo
2010-02-28 16:34:35 +00:00

34 lines
1.8 KiB
Text

The ti(Standard Template Library) (i(STL)) is a general purpose library
consisting of containers, generic algorithms, iterators, function objects,
allocators, adaptors and data structures. The data structures used by the
algorithms are em(abstract) in the sense that the algorithms can be used with
(practically) any data type.
The algorithms can process these abstract data types because
they are emi(template) based. This chapter does not cover
template em(construction) (but see chapter ref(TEMPLATES) for that). Rather,
it focuses on the em(use) of the algorithms.
Several elements also used by the standard template library have already been
discussed in the annotations(). In chapter ref(CONTAINERS) abstract containers
were discussed, and in section ref(FUNOBJ) function objects were introduced.
Also, em(iterators) were mentioned at several places in this document.
The main components of the STL will be covered in this and the next
chapter. Iterators, adaptors, smart pointers, multi threading and other
features of the STL will be discussed in coming sections. Generic
algorithms are covered in the next chapter (ref(GENERIC)).
em(Allocators) take care of the memory allocation within the
STL. The default i(allocator class) suffices for most applications, and is
not further discussed in the annotations().
All elements of the STL hi(standard namespace: and STL) are defined in the
standard namespace. Therefore, a tt(using namespace std) or a comparable
directive is required unless it is preferred to specify the required namespace
explicitly. In header files the tt(std) namespace should explicitly
be used (cf. section ref(NAMESPACEHDR)).
In this chapter the empty i(angle bracket notation) is frequently used. In
code a typename must be supplied between the angle brackets. E.g., tt(plus<>)
is used in the annotations(), but in code tt(plus<string>) may be encountered.