Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
The STL <primer>
Glass G., Schuchert B., Prentice-Hall, Inc., Upper Saddle River, NJ, 1996. Type: Book (9780134549767)
Date Reviewed: Mar 1 1997

The Standard Template Library (STL) is a new standardized feature of the C++ language. It defines a set of container classes, such as list and vector, and a set of algorithms for manipulating them. This volume is superficially similar to the standard reference on the STL [1]. It begins with an overview of the STL and ends with a longer reference section. The introductory material presents the philosophy and techniques along with many examples. The reference section is a methodical listing of all features. The primary audience is experienced C++ programmers who need both an introduction and a reference to the STL. The book is not intended as a college text, though there are a few exercises at the end of each chapter in the first part.

Each part contains many examples of the use of the STL, and while the examples are repetitive, they must be read, since they contain some material that is not sufficiently discussed elsewhere. The examples are given in enough detail that they clearly illustrate the workings of things, but they do not illustrate programming techniques or give insight into problem solving. Given the intended audience, this is not especially problematic.

One important part of the STL standard is that all algorithms are defined relative to a set of efficiency constraints rather than relative to an implementation. The book is generally good at specifying these constraints, but a few important ones are missed. There is a chapter on the standard string class, though this is not part of the STL itself. On the other hand, little attention is given to allocators, a basic part of the STL. There is also too little attention paid to the current state of C++ compilers implementing the STL. Many take some liberties with the specification, which should have been mentioned. In particular, the standard requires template member functions that not all compilers provide. Various workarounds are used, all of which affect generality. The authors seem to assume an implementation that works with older compilers.

The authors work for a company that produces a commercial version of the STL, and some of the company’s private extensions are covered as well. It is usually clear what is standard and what is not, though readers will need to be careful in a few places if they are using other implementations. The extensions covered are publicly available but are not standard.

While I found the book clearly written and useful, with few typographical errors, it has two serious flaws. First, there is no clear explanation of the requirements that the STL imposes on comparison operators. Many STL algorithms will not work correctly (or even terminate) if an operator like < = is used where one like < is called for.

The second flaw occurs in several discussions that seem to imply that one may create a container only from another similar container. In fact, one may program much more generally than that, creating a list from the elements of a vector, for example.

A nice four-page summary of all of the algorithms of the STL gives all of the input/output requirements of each algorithm in a compact form. Each chapter in the first part concludes with a checklist of items covered and a few exercises. The index is too short for a reference work, though the references are alphabetized, which increases their usefulness. An appendix discusses STL resources and how to obtain them.

Reviewer:  Joseph Bergin Review #: CR120193 (9703-0159)
1) Musser, D. and Saini, A. STL tutorial and reference guide. Addison-Wesley Longman, Reading, MA, 1996.
Bookmark and Share
 
Standards (D.2.3 ... )
 
 
Software Libraries (D.2.2 ... )
 
 
Language Constructs and Features (D.3.3 )
 
Would you recommend this review?
yes
no

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy