Alexh <alexh1@sbcglobal.net> wrote:
I have created my own SerializeElements() function but when I run the
code it still uses MFC's version.
I have the following line in my .h file -
class MyClass : Cobject
{
....
};
void AFXAPI SerializeElements(CArchive& ar,CChartInfo* pChartInfo,
int nCount);
I believe you need to specialize SerializeElements template for your
type, rather than overloading it with a non-template function. Like
this:
template<>
void AFXAPI SerializeElements<CCharInfo>(CArchive& ar,CChartInfo*
pChartInfo, int
nCount);
The code in CList::Serialize calls SerializeElements with explicit
template parameter list, like this:
SerializeElements<TYPE>(ar, pData, 1);
This call will never pick a non-template overload.
CList<CChartInfo> is used. The compiler won't generate calls to functions
it doesn't know about.