Hi, all!
I'm having a problem that should be really simple, even if I cannot find the solution... :-)
Somehow I need to create an output stream that should work with files or pipes. That is why I created a simple class to wrap this functionality but I'm not able to make operator<< work with other stuff than characters.
and the idea is that it can be created with a normal ostream as a parameter or an integer that is related to a pipe.
But the definition of fdostream& operator<<(const int n) gives me the following error:
error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
note: candidate 1: fdostream& fdostream::operator<<(int)
candidate 2: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT) [with _CharT = char, _Traits...... blah, blah, blah...
In the case that an ostream is passed as a parameter, the output is associated with a class derived from streambuf, which code is: