开发者

std::ostringstream woes

开发者 https://www.devze.com 2022-12-19 06:29 出处:网络
I can do std::ostringstream os开发者_StackOverflows; oss << 1; oss.str(); so why can\'t I do: ((std::ostringstream()) << 1).str() ?

I can do

std::ostringstream os开发者_StackOverflows;
oss << 1;
oss.str();

so why can't I do:

((std::ostringstream()) << 1).str() ?

Thanks!


The << operator returns the base type ostream, while the str member function exists only on the derived type ostringstream.

0

精彩评论

暂无评论...
验证码 换一张
取 消