I have to overload << for a particular object, and in doing so I use some manipulators from <iomanip> to customize the output. Some of them seem to be permanent though, like std::left and std::right, so what's the best way to customize the output and then reset the stream output format to the way it was?
I thought about making a temporary copy of the stream before I begin and then assign it back when I'm done, but don't I risk losing the input I have already sent to the stream then (if it's not flushed before it's assigned to)? Also, it's seems a bit excessive to do that and I don't even know if you can assign to an ostream object.