Functions | |
template<typename T , typename F > | |
unsigned int | filter (const F &func, const T &container, T &ret) |
template<typename T , typename F > | |
void | map (F &func, const T &container, T &ret) |
template<typename T , typename R , typename F > | |
void | reduce (F &func, const T &container, R &ret) |
template<typename T , typename F > | |
void | for_each (const F &func, const T &container) |
template<typename T , typename F > | |
void | for_each (const F &func, const T &container, void *p) |
unsigned int edelib::filter | ( | const F & | func, | |
const T & | container, | |||
T & | ret | |||
) | [inline] |
Filter given container by calling func on each element. If func returns true for given element, it will be copied to other list.
void edelib::for_each | ( | const F & | func, | |
const T & | container, | |||
void * | p | |||
) | [inline] |
Same as above for_each, but with additional void* parameter that is given to function as second parameter (function is called as func(val, void*)
void edelib::for_each | ( | const F & | func, | |
const T & | container | |||
) | [inline] |
Traverse container calling func on each element. Returns nothing.
void edelib::map | ( | F & | func, | |
const T & | container, | |||
T & | ret | |||
) | [inline] |
Apply func on each element of given container and add it to ret container.
void edelib::reduce | ( | F & | func, | |
const T & | container, | |||
R & | ret | |||
) | [inline] |
Reduce all elements from container using func as function. The best example of this is to sum all elements, like:
int sum(int a, int b) { return a + b; } int ret; list <int> lst; // [1,2,3,4,5] reduce(sum, lst, ret); // result will be in form 1 + 2 + 3 + 4 + 5