add algorithm::for_each

master
Daniel Kolesa 2015-04-20 02:14:55 +01:00
parent c4aa7242fc
commit 6d60b051e8
1 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "octa/functional.h"
#include "octa/range.h"
#include "octa/utility.h"
namespace octa {
template<typename R, typename U>
@ -200,6 +201,13 @@ namespace octa {
return max_element(PointerRange<const T>(il.get(),
il.get() + il.length(), compare)).first();
}
template<typename R, typename F>
F for_each(R range, F func) {
for (; !range.empty(); range.pop_first())
func(range.first());
return move(func);
}
}
#endif