How do you clear a stringstream variable?

后端 未结 8 2085
时光说笑
时光说笑 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:14

    I am always scoping it:

    {
        std::stringstream ss;
        ss << "what";
    }
    
    {
        std::stringstream ss;
        ss << "the";
    }
    
    {
        std::stringstream ss;
        ss << "heck";
    }
    

提交回复
热议问题