Boost logo

Boost :

Subject: Re: [boost] for_each abstraction
From: joel falcou (joel.falcou_at_[hidden])
Date: 2010-11-17 16:42:23


On 17/11/10 22:35, Karsten Ahnert wrote:
> Sure, but there is no to change the way how elements in a range are
> iterated. In my example, the algorithm is entirely provided by for_each
> with the appropriate operation.

That's not the actual problem. Bindign such thing make codes cumbersome
to use in
generic context where you may or may not know if a T must sue for_each
or T::for_each.

The proper way to solve the original question while preserving
genericity is to use tag dispatching
and externally tagging each type supporting on for_each with a proper
compile-time flag thanks to
a proper meta-function then use it to select the implementation fo the
global, free for_each function.


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