I have a templated function declared in my .h and implemented in my .cpp:
//file.h
class FileReader{
template <class T> void Read( T *aValue );
};
//file.cpp
template<class T>
void
FileReader::Read( T *aValue )
{
//implementation
}
To allow the implementation in my .cpp, I had
template void FileReader::Read<uint8_t>( uint8_t * );
template void FileReader::Read<uint16_t>( uint16_t * );
But trying to fix a doxygen issue, someone pointed me here that I should use
template<> void FileReader::Read<uint8_t>( uint8_t * );
template<> void FileReader::Read<uint16_t>( uint16_t * );
This indeed, fixes the doxygen issue, but it breaks my compilation at linking.
=>What is the correct syntax to specialize my function template in my .cpp and allow the function to be linked?
This other question seems to indicate that I should use my second version. But this article uses my first version.