>>730,748
これでどう?
#include <iostream>
#include <sstream>

using namespace std;

class ErrorMessage {
ostringstream os;
public:
ErrorMessage( const char *file, int line ) {
os << file << "(" << line << "): ";
}

template<class T>
ErrorMessage& operator+( T x ) {
os << x;
return *this;
}

operator const string () const {
return os.str();
}
};

void foo( const string& s )
{
cout << s << endl;
}

int main()
{
int a = 10;
char b[] = "hogehoge";

foo( ErrorMessage(__FILE__, __LINE__) + "HOGE(" + a + ") " + b);
return 0;
}