为什么std::ostringstream::ate
不属于ostringstream的默认开放标志?
#include <sstream>
#include <iostream>
int main()
{
std::ostringstream oss;
oss.str("set some string in the stream");
std::cout << oss.str() << std::endl;
oss << "expected a concatenation, but without std::ostringstream::ate flag, the writepos is at 0 after str(\"something\")";
std::cout << oss.str() << std::endl;
return 0;
}
这对我来说是意想不到的行为,所以我认为这是违约的原因。是否还有其他运营商(除了运营商&lt;&lt;)之外还受到开放旗帜的影响?如果writepos默认为字符串结尾,这些会有意想不到的行为吗?