I have an issue converting VC++6 code to VC++ 2010. The following template function definition is not allowed by the new compiler:
1 2 3 4 5 6
template <> void AFXAPI DelElems <CBrush*> ( CPen** objects, int count ) {
for ( int i = 0; i < count; i++, objects++ )
if (*objects)
delete *objects;
}
All errors refer to the header of the template function:
- syntax error : '<'
- syntax error : missing ';' before '<'
- 'DelElems' : illegal use of type 'void'
- unrecognizable template declaration/definition
What could be the possible reason for those error messages?
Thanks for your help!
No, unfortunately it doesn't function. I've got a tip I should distinguish between a template function specializition and its definition. The code I've posted is in a .cpp file. Should I specialize the template function in a header file?