How do I check if a StringStream variable is empty/null?

前端 未结 8 839
粉色の甜心
粉色の甜心 2020-12-13 08:32

Just a quick question here guys. I\'ve been searching to no avail so far.

A bit more info here:

stringstream report_string;

report_string << \         


        
8条回答
  •  粉色の甜心
    2020-12-13 09:21

    This method is efficient and should work with output strings as well:

    ostringstream report_string;
    
    if (report_string.tellp() == 0) {
        // do something
    }
    

提交回复
热议问题