{logo}

August 2001
Volume 19 Number 8

CLIENT/SERVER

A Cookie Manager Class for Web Applications

Babu George Padamadan
Padamadan’s classes make managing state in a client-server environment a sweet experience.

FEATURES

Tuple Types and Multiple Return Values

Jaakko Järvi
There are several ways to return multiple values from a function in C++. Here is an elegant way that will give your template-grokking brain a real workout.

Generalizing the Concepts Behind auto_ptr

Cristian Vlasceanu
The C++ auto_ptr template can plug a memory leak — too bad that’s not the only possible “leak.” Here’s a template that can close files, release Windows handles, and anything else you tell it how to do.

C/C++ CONTRIBUTING EDITORS

Common Knowledge: One at a Time, Please

Steve Dewhurst
Still having trouble kicking the preprocessor habit? Here is some strong motivation for crossing that bridge.

STL & Generic Programming: Writing Your Own Iterators

Thomas Becker
To our delight and edification, Thomas continues his iteration on iterators. This time we get help defining specialized iterators for our own containers.

C++ Made Easier: Which Container Should I Use?

Andrew Koenig & Barbara E. Moo
It seems that deques are often mispronounced and seldom used. Here is wisdom on when to use them, as well as when to use the other two standard sequence containers.

Uncaught Exceptions: Nevermind

Bobby Schmidt
Bobby is at his enthusiastic best after deleting a job that wasn’t what it seemed. Deleting an object in C++ isn’t always what it seems, either.

Post-Mortem Debunker: Coder Block

Stan Kelly-Bootle
While there exists code that should never have been written, certainly YOU didn’t write it. So why are you reading this column rather than coding?

DEPARTMENTS

Editor’s 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>: Typed Buffers (I)"

by Andrei Alexandrescu
You thought buffers were an uninteresting subject? Try to write a buffer that’s at the same time generic and efficient. Hint: efficient buffers are easy, and generic buffers are easy, but buffers that are both generic and efficient are hard. This article is the first of a two-part treatment of typed buffers, heavy-duty components that can replace std::vector in performance-demanding applications.

"The Standard Librarian: Sorting in the Standard Library"

by Matt Austern
The Standard C++ library provides a half dozen different tools for sorting, and knowing when to use which one is an essential part of knowing how to use the library properly. In some cases, the choice of sort function can make an enormous difference in performance.

"Conversations: The Bind That Ties"

by Jim Hyslop and Herb Sutter
The standard library provides adaptors that extend the flexibility and power of the standard functions. While some of them may seem scary at first glance, they really are quite simple to use.

"From Mechanism to Method: Data Abstraction and Heterarchy"

by Kevlin Henney
Hugged a tree today? Perhaps not, but you have probably been living and working in one if you are a C++ programmer. The most easily recognizable trees in a C++ program are class hierarchies, but there are others, including other type hierarchies. This month’s column looks first at the species you can grow in C++, and then beyond: heterarchies include cycles whereas hierarchies are layered. Unlike the common-or-garden tree, a type heterarchy includes a substitutability relationship with a twist or, to be precise, a cycle.

"Engineering Notebook: Template Method & Strategy — Inheritance vs. Delegation"

by Robert C. Martin
This installment of “Engineering Notebook” is the story of two patterns, Template Method and Strategy, that epitomize the difference between inheritance and delegation.