In C++, is it possible to have a function that accepts all types?
Basically, I want to override the left-shift operator so that I can do the following.
Code:
myVar << a << b << moreStuff << "blah" << endl;
Is there a way I can accomplish this so that I don't have to override dozens of operator functions?
I would like to do something like this:
Code:
MyClass& MyClass::operator<<(??? var)
{
stringstream stream;
stream << var;
// do something with stream.str()
return *this;
}
Thanks in advance.