Boost logo

Boost :

From: Dave Harris (brangdon_at_[hidden])
Date: 2005-05-02 12:57:34


In-Reply-To: <d55ii6$74o$1_at_[hidden]>
gennadiy.rozental_at_[hidden] (Gennadiy Rozental) wrote (abridged):
> 1. Not to mention the collection type
> As Eric pointed out - you may not know one. But even if you do writing
> std::vector<mytypes<my_param> > several types for every loop I need is
> tidies.

I generally solve that problem with a typedef. Most of the time the
collection is a class, the typedef is a member of that class, and the
iterating code is a member function of that class. So the word "iterator"
is all I need. If your loops are so complex you would benefit from
BOOST_FOREACH, I think you'd also benefit from simplifying them,
separating concerns a bit more, etc.

> Since you agree that looping is quite basic need - simplifying it is a
> worthy task.

I agree it's a worthy ambition, but this doesn't simplify them. It makes
them much more complex and then tries to hide the complexity behind a
macro.

> As for the complexity it's required to support some corner
> cases situation. You could always disable it with defines (that what I
> am going to do).

Adding #defines is adding complexity.

-- Dave Harris, Nottingham, UK.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk