From 3bd0ab8f7516cf9e1c37481f1904f0d1e4b684dc Mon Sep 17 00:00:00 2001 From: phintuka Date: Wed, 3 Feb 2010 13:58:05 +0000 Subject: Added template for functions with four arguments --- tools/listiter.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/listiter.h b/tools/listiter.h index 9c88940e..e16353cb 100644 --- a/tools/listiter.h +++ b/tools/listiter.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: listiter.h,v 1.1 2006-06-03 10:04:27 phintuka Exp $ + * $Id: listiter.h,v 1.2 2010-02-03 13:58:05 phintuka Exp $ * */ @@ -68,6 +68,18 @@ RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1,ARG2,ARG3), return result; } +template + RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1,ARG2,ARG3,ARG4), + ARG1 arg1, ARG2 arg2, ARG3 arg3, ARG4 arg4, + RESULT (*combiner)(RESULT,RESULT), RESULT def) +{ + RESULT result = def; + for(ITEM *it = List.First(); it; it = List.Next(it)) + result = (*combiner)((*it.*f)(arg1,arg2,arg3,arg4),result); + return result; +} + template T mmin(T a, T b) {return a