Reputation: 11201
Suppose I have two APIs that I need to interact with:
const char*
) and a length (say std::size_t
).std::istream
.I'd like to use this buffer for a std::istringstream
, but if I'm not mistaken, I'll have to turn the raw character buffer into a std::string
first, copying its contents. I'd like to avoid that.
So my question is: Is there a way I could directly make an istringstream
read from a buffer without copying the buffer using the stdlib, and without writing my own bufferstream
class?
Is there a good reason for istringstream
s being restricted to, well, strings - especially since using strings as buffers is considered bad practice?
Upvotes: 0
Views: 101