I have a static template function in my class like that:
file.hpp:
class File
{
public:
template<typename Type>
static Type read(const std::string & fullPath, const std::ios_base::openmode mode = std::ios_base::in);
};
template<typename Type>
Type File::read(const std::string & fullPath, std::ios_base::openmode mode)
{
std::stringstream ss;
ss << readImpl(fullPath, mode);
Type value = Type();
ss >> value;
return value;
}
file.cpp:
template<>
std::string File::read(const std::string & fullPath, std::ios_base::openmode mode)
{
return readImpl(fullPath, mode);
}
readImpl just return a string.
So, my question is why my specialization of the read method to std::string is not called when I run something like that:
const std::string content = File::read<std::string>(path);
Thanks