
17 Nov
2010
17 Nov
'10
9:42 p.m.
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.