且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ostringstream和复制构造函数的问题

更新时间:2022-12-13 22:38:24

已经对C ++中的任何流类进行了复制构造函数和复制分配私人。这意味着,您无法复制 std :: ostringstream 对象:

Copy constructor and copy-assignment of any stream class in C++ has been made private. That means, you cannot make copy of std::ostringstream object:

std::ostringstream ss;

std::ostringstream ss1(ss); //not allowed - copy-constructor is private
ss1=ss; //not allowed - copy-assignment is private