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

In-Reply-To: <42778635.20706@boost-consulting.com> eric@boost-consulting.com (Eric Niebler) wrote (abridged):
* This isn't an algorithm, so I don't want to evoke std::for_each.
What is it that makes std::for_each an algorithm and BOOST_FOREACH not? To me they seem to be doing similar jobs, albeit in different ways. -- Dave Harris, Nottingham, UK.

Dave Harris wrote:
In-Reply-To: <42778635.20706@boost-consulting.com> eric@boost-consulting.com (Eric Niebler) wrote (abridged):
* This isn't an algorithm, so I don't want to evoke std::for_each.
What is it that makes std::for_each an algorithm and BOOST_FOREACH not? To me they seem to be doing similar jobs, albeit in different ways.
Is do/while an algorithm? You probably don't think of it that way. It's certainly not an algorithm in the STL sense like std::for_each is. The most effective way to think of BOOST_FOREACH (in my experience) is as a new looping construct -- a foreach keyword. To encourage people to think of it as an algorithm in the STL sense would be a mistake. It is range-based, not iterator-based. You can break and continue and return from the loop body. You can't do any of those things from an STL algorithm. -- Eric Niebler Boost Consulting www.boost-consulting.com

brangdon@cix.compulink.co.uk (Dave Harris) writes:
In-Reply-To: <42778635.20706@boost-consulting.com> eric@boost-consulting.com (Eric Niebler) wrote (abridged):
* This isn't an algorithm, so I don't want to evoke std::for_each.
What is it that makes std::for_each an algorithm and BOOST_FOREACH not?
You might consider just answering the first part of that question for yourself: "what is it that makes std::for_each an algorithm?" -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
brangdon@cix.compulink.co.uk
-
David Abrahams
-
Eric Niebler