diff options
author | phintuka <phintuka> | 2010-03-15 14:13:43 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2010-03-15 14:13:43 +0000 |
commit | f1448bf024c8bb464a15914e11f1f773192e671c (patch) | |
tree | 84bd6452874e260fe43c6d953318aef87f2b1878 | |
parent | 6d5a5682ef3c451f769d508cd9ac8a819dcb20fa (diff) | |
download | xineliboutput-f1448bf024c8bb464a15914e11f1f773192e671c.tar.gz xineliboutput-f1448bf024c8bb464a15914e11f1f773192e671c.tar.bz2 |
Template for void func(a,b,c,d,e)
-rw-r--r-- | tools/listiter.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/listiter.h b/tools/listiter.h index e16353cb..f1ea1308 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.2 2010-02-03 13:58:05 phintuka Exp $ + * $Id: listiter.h,v 1.3 2010-03-15 14:13:43 phintuka Exp $ * */ @@ -35,6 +35,13 @@ void ForEach(LIST& List, void (ITEM::*f)(ARG1,ARG2), ARG1 arg1, ARG2 arg2) (*it.*f)(arg1,arg2); } +template <class LIST,class ITEM, class ARG1, class ARG2, class ARG3, class ARG4, class ARG5> + void ForEach(LIST& List, void (ITEM::*f)(ARG1,ARG2,ARG3,ARG4,ARG5), ARG1 arg1, ARG2 arg2, ARG3 arg3, ARG4 arg4, ARG5 arg5) +{ + for(ITEM *it = List.First(); it; it = List.Next(it)) + (*it.*f)(arg1,arg2,arg3,arg4,arg5); +} + template <class LIST,class ITEM, class ARG1, class RESULT> RESULT ForEach(LIST& List, RESULT (ITEM::*f)(ARG1), ARG1 arg1, RESULT (*combiner)(RESULT,RESULT), RESULT def) |