给定一个以输出stringstream为参数的函数:
void Foo(const std::ostringstream& _oss);
有没有一种方法可以将流缓冲区写入文件,而无需调用str()?
我想避免复制缓冲区(str()会这样做)。
void Foo(const std::ostringstream& _oss);
{
std::ofstream f("foo.bin");
//WANT: write _oss to f without copying the buffer?
}
ostringstream
,那么相关的stringbuf
是否可以在仅输出模式下构造? - Nemo