私は次の問題を抱えています:
template<class T>
void set(std::string path, const T data)
{
stringstream ss;
ss << data << std::endl;
write(path, ss.str();
}
template<class T>
void set(std::string path, const T data)
{
std::stringstream ss;
for(typename T::const_iterator it = data.begin(); it < data.end(); ++it)
{
ss << *it;
if(it < data.end() -1 )
ss << ", ";
}
ss << std::endl;
write(path, ss.str());
}
次のエラーが発生します。
error: ‘template<class T> void myclass::set(std::string, T)’ cannot be overloaded
error: with ‘template<class T> void myclass::set(std::string, T)’
テンプレート内のコンテナタイプと他のタイプを区別する方法はありますか?