Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2000-12-07 10:50:42

On request of David Abrahams I removed my beloved iterator
macros from a few 'getting started' examples that I wrote
for the Boost Python Library.

Here is what I normally use:


#define rangei(n) for (int i = 0; i < n; i++)
#define range1(i, n) for (int i = 0; i < n; i++)
#define range2(i, f, n) for (int i = f; i < n; i++)
#define range3(i, f, n, s) for (int i = f; i < n; i += s)

#endif // DEFINE_RANGE_H

This simple include file allows me to make my source code
look a lot more concise. What is bad with this approach?
Is it just "bad style" (why?), or are there more fundamental
(i.e. real) problems?

This is probably not the most important question in the world,
but each time I see myself typing (for int i = 0; i < 3; i++)
I keep saying to myself that there must be a better way of
doing this...


Boost list run by bdawes at, gregod at, cpdaniel at, john at