So istringstream
copies the contents of a string when initialised, e.g
string moo("one two three four");
istringstream iss(moo.c_str());
I was wondering if there's a way to make std::istringstream
use the given c_str
as its buffer without copying things. This way, it won't have to copy large bits of memory before passing the std::istringstream&
to functions that take istream&
as an argument.
What I've been trying to do is convert some functions which only take std::ifstream&
arguments (they're mostly parsers) into taking istream&
as well. Would I have to make my own istream
subclass for this?