如何高效复制istringstream?
还是奥斯特流?
istringstream a("asd");
istringstream b = a; // This does not work.
我想 memcpy 也不起作用。
Or ostringstream?
istringstream a("asd");
istringstream b = a; // This does not work.
I guess memcpy won't work either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑:
根据您对其他回复的评论,听起来您可能还想将 fstream 的全部内容复制到 strinstream 中。你也不想/必须一次只做一个角色(你是对的——这通常很慢)。
Edit:
Based on your comment to the other reply, it sounds like you may also want to copy the entire contents of an fstream into a strinstream. You don't want/have to do that one character at a time either (and you're right -- that usually is pretty slow).
您不能只复制流,还必须使用迭代器复制它们的缓冲区。例如:
You can't just copy streams, you have to copy their buffers using iterators. For example: