Course Description:

The C++ Standard Library & STL

A large part of programming involves mundane tasks such as managing collections of objects, manipulating text strings, searching, sorting and performing formatted input and output which, though conceptually simple are hard to get right. The draft international C++ standard defines a library of general-purpose classes and functions that simplify such tasks. The standard classes also provide a means of data interchange between different third-party libraries. At the core of the C++ Standard Library is the Standard Template Library (STL), a set of container classes, algorithms and related components designed to be combined in powerful ways. Programmers can extend the power of the standard library by adding their own components.

One does not really know C++ unless one understands the standard library. The focus of this course is on learning the philosophy and structure of the standard library, especially the STL, rather than the details of every class and function. It is not intended to substitute for a reference book on the standard library. Concepts are reinforced by numerous hands-on labs.

PREREQUISITES: 6 months experience programming in C++ (recommended)

DURATION: 3 days

Overview of topics covered

WHAT IS THE C++ STANDARD LIBRARY? 

  • Is it really standard yet?
  • Parts of the library
  • What is STL?
  • Overview of the STL
  • The C Standard Library

IMPORTANT LANGUAGE FEATURES 

  • Header files without “.h” 
  • namespace std 
  • Advanced templates
  • The native bool type 

GENERIC CONTAINERS 

  • Sequence containers 
  • Sorted associative containers 
  • Hashed associative containers 
  • Constructing & Sizing Containers
  • Inserting, removing and accessing elements 
  • Copying containers 
  • Container adaptors 
  • Allocators 
 

ITERATORS 

  • Traversing containers
  • Pointers as iterators
  • Iterator operations 
  • Iterator categories 
  • Const and reverse iterators 
  • Inserting and erasing using iterators

ALGORITHMS AND FUNCTION OBJECTS 

  • Algorithm categories 
  • Algorithms and iterators 
  • Naming conventions 
  • Inserters
  • Modifying algorithms using function objects 
  • Negators and binders 

STRINGS

  • Strings in C and C++
  • String operations
  • Converting to and from C-style strings
  • Substrings
  • Search functions

STREAMS

  • Type-specific I/O
  • fstreams and stringstreams
  • Format control
  • Unformatted I/O
  • Error handling
  • I/O for user-defined types
  • User-defined stream types

EXTENDING THE STL 

  • General principles 
  • Defining new algorithms 
  • Defining new function objects 
  • Defining new adaptors 
  • Defining new containers and iterators

ADVANCED TOPICS

  • Class auto_ptr<T>
  • Numeric support
  • Bit sets
  • Locale
  • Tips for good performance
  • Traits classes
  • Exception safety
  • Comparison to Rogue Wave Tools.h++™

 [ Halpern-Wight Software, Inc. home page ]