The following code gives C2660 error in Visual Studio 2015 Community:
class Logger {
public:
template <class T> void writeLine(const T& value) {
if (this->filestream.is_open()) {
filestream << object << std::endl;
}
}
template <typename T> void write(const T& value) {
if (this->filestream.is_open()) {
filestream << value;
}
}
template <typename T, typename... Targs> void write(const T& value, const Targs&... args) {
if (this->filestream.is_open()) {
filestream << value;
this->write(args...);
}
}
// ... singleton stuff
}
I'm calling the function like this:
#define LOG(x) Logger::instance().write(__FILE__, " (line ", __LINE__, "): ", x, std::endl);
Here is the error in the output log:
encoder.cpp(51): error C2660: 'Logger::write': function does not take 6 arguments