Tech-Talk

Designing C++ Iterators

By Reg. Charney

If you plan to design a container class of objects, you often want to access each element of the container. Iterators can do this. Here is a simple recipe for creating iterators for your containers:

The C::begin() member function connects the this pointer for the container with each defined iterator.

To save space below, many normal member functions have been omitted from this executable example.

Iterator Categories

Iterators come in five categories, remembered using the acronym BRIEF: Bi-directional, Random, Input, Emit/output, and Forward.

Input iterators:

Emit/Output Iterators

Forward Iterators

Bi-Directional Iterators

Random Iterators

The container’s design solely determines the category of iterator. You can not impose an iterator or iterator category onto a container from the outside.

Material for designing iterators can be found in Designing Components with the C++ STL by Ulrich Breymann, Addison-Wesley, ISBN 0-201-67488-2. And again, Nicolai M. Josuttis’s The C++ Standard Template Library, Addison-Wesley, ISBN 0-201-37926-0 is also an excellent source for examples and information on iterators.

Iterator Example

Editorial

By Reg. Charney

My Mistake + Apologies

I have had a lot of fun designing, creating, and writing this newsletter. But in the last issue, I had gone too far and I was not serving you and for this I offer my apologies. Last month’s editorial comment was the largest part of the newsletter. It did not start out that way, but time and other factors got in the way. I also realized that in my first issue, I promised to be pithy, to the point and technically oriented. Again, that did not happen, except for the excellent technical article by Michael Ball on Compile-Time Template Calculations. Lastly, the technical content was almost buried on page three. All in all, not a good way to go.

So I am now going to make a commitment to you. One that is measurable and one that I can use as a benchmark. The editorial content of the newsletter will be limited to one column in this four-page format (i.e., 12% of the newsletter). Second, the technical articles are going to have pride of place. Each newsletter will start with technical material, not editorial, on page one. The editorial will not appear on page one unless really extraordinary circumstances dictate that it do so. Lastly, some form of the newsletter will appear on the web, hopefully, by the time you read this.

This newsletter is here to serve you, so let’s hear your feedback – good or bad . Please let us know how best to do this.

Name Change

Recently, I have had some negative comments to the name ACCU’SiVe. It sounded too much like j’accuse – which some Frenchman, Victor Hugo, has already taken. We have received some suggestions, but want more. Starting with this issue, ACCU’SiVe has been renamed ACC++ent. However, if you have a better name, let us know.

Trends

By Reg. Charney

SD’2000

The Software Development 2000 Conference in San Jose has just finished, so instead of doing job market statistics, I thought you might be interested in the changes over the last year in a number of show categories.

Measurement was by counting vendors and the categories that they represented. There were some changes in categories from 1999 to 2000. For example, no one advertises 3GLs any longer, while middleware is a new category in 2000. The only major positive change was that the number of vendors offering client/server solutions increased. Comparing categories is difficult because one can argue about material changes as opposed to buzzword changes.

Even though the numbers were smaller than last year, the courses offered were very good— especially the tutorials. I was also surprised by some of the exhibits, which I will discuss next.

Figure #1

Figure #2

What’s Hot and What’s Not

Lost Boys

This was the most visually impressive product I saw. Lost Boys’ multimedia C++ development environment is smooth, powerful and seems easy to use and program. It works on a whole range of machines, from old Pentiums to the latest speed demons, under Windows, Linux, BeOS and MacOS. They are from the Netherlands. Their demo of Anne Frank’s house is spectacular. You can find them at www.lostboys.com. Their website is also a treat.

Whisper Programmer Studio

These U.K. folks have a very nice IDE that is platform independent. Their features match the most sophisticated ones on Windows. It is also compiler and tool independent. You can find them at www.wispertech.com.

VMWare v2.0

Although not a new product, the improvements and features of this product make it an essential tool for developers. The ability to roll back changes and maintain reference platforms is wonderful. See them at www.vmware.com.