![]()
June 2001
Volume 19 Number 6ALGORITHMS
Three Guidelines for Effective Iterator Usage
Scott Meyers
It is easy to write code that uses STL iterators, but beware lest you write code thats brittle or wont port. Here are a few things you might need to know.Implementing Reusable Mathematical Procedures Using C++
Qiang Liu
Algorithms that must call user-supplied functions are typically difficult to reuse. The key to reuse is finding a way to encapsulate the user-defined code.BOOK REVIEW
Accelerated C++
reviewed by Francis Glassborow
Maybe youve been hearing the buzz about some new approach to learning C++. Heres the book thats got everyone talking.C/C++ CONTRIBUTING EDITORS
The New C: Compound Literals
Randy Meyers
Structs in C are not quite first class types, but with the help of compound literals, they are at least a lot easier to use.STL and Generic Programming: More on Iterators
Thomas Becker
To use STL iterators efficiently, you need to make decisions based on iterator type. The beauty of generic programming is that you can make those decisions at compile time.Common Knowledge: Split Idioms
Stephen Dewhurst
It is better to break a rule of thumb than to break your thumbs on a difficult problem.Uncaught Exceptions: All Good Things
Bobby Schmidt
Some words of wisdom for the departing editor, and as usual some priceless C/C++ info for readers.C++ Made Easier: The Rule of Three
Andrew Koenig & Barbara E. Moo
What you leave out of a class can cause you just as much trouble as what you put in. This simple rule will save you the most common mistakes.Post-Mortem Debunker: What Next?
Stan Kelly-Bootle
Does time come in packets? No big deal. Its that arrow of time we all have to worry about...DEPARTMENTS
Editors Forum
New Products
We Have Mail
C++ EXPERTS ON THE WEB
In this new, web-only component of CUJ, we continue publication of the columns that were popular in the former C++ Report magazine. The following articles are featured on the CUJ website this month:
"Generic<Programming>: A Policy-Based basic_string Implementation"
by Andrei Alexandrescu
Happy with your basic_string implementation? This article explains why one size does not fit all, and why you should sometimes worry about the details of your standard string implementation. Furthermore, the article provides and explains a policy-based basic_string implementation that gives you twelve Standard-compliant canned implementations featuring various optimizations and tradeoffs, and, most important, brings you within some 200 lines of code from your dream basic_string implementation."The Standard Librarian: Defining a Facet"
by Matt Austern
Locales, originally invented for internationalization, are a general-purpose mechanism that is closely integrated with the C++ I/O library. Like all of the other components of the Standard C++ library, locales were designed to be user-extensible. This article explains what locales and locale facets are, how the locale mechanism works, and how users can define new facets to extend locale functionality."Conversations: Abstract Factory, Template Style"
by Jim Hyslop and Herb Sutter
Abstract class factories can be time-consuming and difficult to maintain. Many implementations rely on manually-maintained lookup tables, extensive use of macros, or non-portable idioms. This month, our authors present a generic, portable, abstract class factory."Effective C++ Standard Library: Curiously Recurring Manipulators"
by Klaus Kreft and Angelika Langer
Modern programming techniques make life easier. As an example, the authors study implementation of stream manipulators (which they discussed in earlier publications, but using traditional techniques). This time they combine template programming techniques, functors, and the Curiously Recurring Template pattern into an amazingly elegant solution. The contrast between classic and modern techniques is stark and convincing.Visit the "C++ Experts Forum" at <www.cuj.com/experts/>.