I have a class that contains decoded video frames. I would like my decoder to use an output_iterator to write those frames to different targets. In order to support writing directly to a file, I want to overload operator << for my decoded frame class (for use with ostream_iterator). The problem is, that operator << is meant to be used for formatted output, but I want to do unformatted output with it. Are there any pitfalls to be considered? Is there another solution, or is it OK to just go with that?
views:
72answers:
2
+1
A:
std::basic_ostream is indeed mainly to be used for formatted output. (I say "mainly" because it does have a method for unformatted output. But that's not accessible through output iterators.) For unformatted output, use a stream buffer iterator.
sbi
2010-04-06 10:12:08
I was not aware of that class, thank you!
Space_C0wb0y
2010-04-06 10:19:26