You're viewing a comment by Gennaro Prota and its responses.

May 19, 2010, 00:04

Oops, I forgot to stick to input iterators, sorry. It should of course be:

template< typename InputIterator, typename Function >
for_each( InputIterator first, InputIterator last, Function f )
    if ( first != last ) {
        f( *first ) ;
        ++ first ;
        for_each( first, last, f ) ;
    return f ;

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "coding_219": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.