![]()
June 2002
Volume 20 Number 6ALGORITHMS
A Multiple Substring Search Algorithm
Moishe Halibard and Moshe Rubin
You will surely find this generalization of find_first_of for multiple substrings both elegant and useful. What's more, it's very efficient.Keyword Correction from a Dictionary
Larry Andrews
Have your computer understand what you mean, not just what you say, with this effective string matching algorithm.Using Genetic Algorithms
Mark Bucci
A lucid primer on genetic algorithms, along with a handy template to get you started.FEATURES
Retargeting the GNU C Compiler
Michael Collison
An inside look on how to deploy the GNU C compiler to your platform of choice.C/C++ CONTRIBUTING EDITORS
STL & Generic Programming: STL Function Objects and Their Adaptors
Thomas Becker
STL is more than just algorithms, containers, and iterators. Function objects and adaptors greatly enhance your ability to use STL effectively.C++ Made Easier: Avoiding Array Overruns
Andrew Koenig & Barbara E. Moo
The abstractions in the Standard C++ library keep you from trashing memory and committing related transgressions (admit it you're guilty!), and they make for more elegant code. Use them.Common Knowledge: Running Circles Round You, Logically
Steve Dewhurst
Remember that old bitwise trick to swap two integers without a temporary? (Of course you do it's Common Knowledge). With a little imagination you can use that technique to craft iterators that don't know which way to go.DEPARTMENTS
Editors Forum
New Products
We Have Mail
C++ EXPERTS ON THE WEB
In this web-only component of CUJ, we publish columns by experts involved in the development, standardization, and deployment of C++. The following articles are featured on the CUJ website this month:
From Mechanism to Method: State Government
by Kevlin Henney
Sometimes objects can get themselves into a state. It is a matter of design (art, science, inspiration, and coffee) that determines whether this state is a comfortable one or not. This months column tackles some of the issues involved in realizing state models in C++, exploring a language oddity, and redressing some common pattern misconceptions en route.Generic<Programming>: Discriminated Unions (II)
by Andrei Alexandrescu
We continue working on our Variant design and implementation. This time we focus on storage how data is stored and accessed. This article presents techniques for computing alignment of types with reasonable accuracy and portability. Then, once the storage proper is in place, we need polymorphic means to manipulate that storage for which Variant uses the fake vtable idiom.Conversations: The Good, the Bad, and the Deprecated
by Jim Hyslop and Herb Sutter
What can go wrong when your code gives you a bit too much... er... static.