00001
00002
00003 #ifndef ML_ALGORITHM_FOR_EACH_IF_HPP
00004 #define ML_ALGORITHM_FOR_EACH_IF_HPP
00005
00006 namespace ml_algorithm
00007 {
00008 template<class InputIterator, class Function, class Predicate>
00009 Function for_each_if (InputIterator first, InputIterator last, Function f, Predicate pred )
00010 {
00011 while (first != last) if (pred(*first)) f(*first++);
00012 return f;
00013 }
00014 }
00015
00016 #endif
00017