我必须在(C++,我使用 MS Visual Studio 2008 SP1)中对类成员函数使用显式特化,但我无法成功编译它。得到
错误 C2910: 'File::operator <<' : 不能明确专门化
class File
{
std::ofstream mOutPutFile;
public:
template<typename T>
File& operator<<(T const& data);
};
template<typename T>
File& File::operator<< (T const& data)
{
mOutPutFile << preprosesor(data);
return *this;
}
template< >
File& File::operator<< <> (std::ofstream& out)
{
mOutPutFile << out;
return *this;
}