How do you clear a stringstream variable?

后端 未结 8 2028
时光说笑
时光说笑 2020-11-22 13:53

I\'ve tried several things already,

std::stringstream m;
m.empty();
m.clear();

both of which don\'t work.

8条回答
  •  执笔经年
    2020-11-22 14:10

    This should be the most reliable way regardless of the compiler:

    m=std::stringstream();
    

提交回复
热议问题