C
canderse
I am beginning to use templates alot (in visual studio 2008) but I
writing this simple template
that has a method which takes a function pointer as an argument and i
cant figure out why the will not compile
LONG __cdecl FilterListProc(LPVOID Item1,LPVOID Item2,LPVOID pParam =
NULL);
template<class TItemList,class TItemData>
class CFiltredListImpl
{
private:
class vaiables anf methods
...
public:
BOOL Filter(LONG (__cdecl *FilterProc)(LPVOID,LPVOID,LPVOID),LPVOID
lpPram = NULL)
{
return TRUE;
};
};
idearly it would like the function to look like this
LONG __cdecl FilterListProc(LPVOID Item1,LPVOID Item2,LPVOID pParam =
NULL);
template<class TItemList,class TItemData>
class CFiltredListImpl
{
private:
class vaiables anf methods
...
public:
BOOL Filter(LONG (__cdecl *FilterProc)(LPVOID,LPVOID,LPVOID) =
FilterListProc ,LPVOID lpPram = NULL)
{
return TRUE;
};
};
or even better it would be better if I could write it like this
template<TItemData>
LONG __cdecl FilterListProc(TItemData & Item1,TItemData & Item2,LPVOID
pParam = NULL);
template<class TItemList,class TItemData>
class CFiltredListImpl
{
private:
class vaiables anf methods
...
public:
BOOL Filter(LONG (__cdecl *FilterProc)(TItemData &,TItemData,LPVOID)
= FilterListProc ,LPVOID lpPram = NULL)
{
return TRUE;
};
};
My first question is why will the first version compile and my second
is the other two implementation feasible
Your help would be apreciated
Thanks Christian Arild Stær Andersen
writing this simple template
that has a method which takes a function pointer as an argument and i
cant figure out why the will not compile
LONG __cdecl FilterListProc(LPVOID Item1,LPVOID Item2,LPVOID pParam =
NULL);
template<class TItemList,class TItemData>
class CFiltredListImpl
{
private:
class vaiables anf methods
...
public:
BOOL Filter(LONG (__cdecl *FilterProc)(LPVOID,LPVOID,LPVOID),LPVOID
lpPram = NULL)
{
return TRUE;
};
};
idearly it would like the function to look like this
LONG __cdecl FilterListProc(LPVOID Item1,LPVOID Item2,LPVOID pParam =
NULL);
template<class TItemList,class TItemData>
class CFiltredListImpl
{
private:
class vaiables anf methods
...
public:
BOOL Filter(LONG (__cdecl *FilterProc)(LPVOID,LPVOID,LPVOID) =
FilterListProc ,LPVOID lpPram = NULL)
{
return TRUE;
};
};
or even better it would be better if I could write it like this
template<TItemData>
LONG __cdecl FilterListProc(TItemData & Item1,TItemData & Item2,LPVOID
pParam = NULL);
template<class TItemList,class TItemData>
class CFiltredListImpl
{
private:
class vaiables anf methods
...
public:
BOOL Filter(LONG (__cdecl *FilterProc)(TItemData &,TItemData,LPVOID)
= FilterListProc ,LPVOID lpPram = NULL)
{
return TRUE;
};
};
My first question is why will the first version compile and my second
is the other two implementation feasible
Your help would be apreciated
Thanks Christian Arild Stær Andersen