Re: [boost] Re: Re: Formal Review: FOREACH macro

In-Reply-To: <d55ii6$74o$1@sea.gmane.org> gennadiy.rozental@thomson.com (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.

Adding #defines is adding complexity.
I think it's a kinda an attitude issue: you see all macros as enemies. I see some of them as friends. Macros in general (and FOREACH in particular) are in most cases only usability helpers (there is also configuration switched domain, but it's beside the point). And until language provide as-convenient alternatives I am ready to accept the macro nature of these tools. Gennadiy
participants (2)
-
brangdon@cix.compulink.co.uk
-
Gennadiy Rozental