Boost logo

Boost Users :

Subject: Re: [Boost-users] Overloading boost::for_each()
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-08-29 14:27:17

On Sun, 29 Aug 2010, Eric Niebler wrote:

> On 8/29/2010 1:03 PM, Jeremiah Willcock wrote:
>> I think just overloading for_each() and writing algorithms in terms of
>> that when possible would get the same benefits, though.
> This way lies madness. The separation of containers and algorithms in
> the STL is what keeps it manageable. You don't want to implement N
> algorithms over M container types. You want to define a concept on which
> you can "overload" for_each.

Yes, that's what I meant. Have a default implementation, but specifically
allow it to be overloaded, then make other algorithms use for_each() so
that they can use overloaded versions. Maybe the base algorithm should be
some kind of fold like it is in a functional language, though.

-- Jeremiah Willcock

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at