Hello! My problem can be described the following way:
I have some data which actually is an array and could be represented as char* data
with some size
I also have some legacy code (function) that takes some abstract std::istream
object as a param and uses that stream to retrieve data to operate.
So, my question is the following - what would be the easy way to map my data
to some std::istream
object so that I can pass it to my function? I thought about creating a std::stringstream
object from my data
, but that means copying and (as I assume) isn't the best solution.
Any ideas how this could be done so that my std::istream
operates on the data
directly?
Thank you.
If you're looking at actually creating your own stream, I'd look at the Boost.Iostreams library. It makes it easy to create your own stream objects.
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