I'm trying to write a function that writes information to a stream. I need to be able to pass it either a stringstream or an ostream. I tried declaring the function with F(std::ios* out), but then later when I use the << operator to write to it, I get this error: error: no match for operator<<. How should I be declaring the function?
First of all, you should probably pass a reference to the stream, because otherwise you'll have to write (*out)<< to make the insertion operator work correctly (it works on streams, not on pointer to streams).