Is there a way to use these operators to input and output binary data? The reason I want to do this is that it makes the code readable. Ex: infile >> filedecrypter >> metadataparser >> audiodecoder >> effects >> soundplayer;
Just to be clear, are you intending to duplicate the semantics of iostreams? Because it looks like you are proposing something different. In the example you give:
infile >> filedecrypter >> metadataparser >> audiodecoder >> effects >> soundplayer;
In iostreams, the meaning here is to read from infile into filedecrypter until you get to whitespace, and then from infile into metadataparser until more whitespace, and so on.
It looks like you are proposing something different, where metadataparser reads from filedecrypter, audiodecoder from metadataparser, etc. In which case I think the answer to your question needs to be qualified a bit.
Can you use operator >> to express this construct? Probably yes.
Can you use iostreams for this? Probably not.
I suggest you clarify what it means when you say A >> B. Perhaps express it as regular methods rather than operator overloads first, and that may clarify the question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With