I struggle to understand the different behaviours of stringstream from the following code. Can someone shed a light on how stream internally works?
int main(){
string str = "123";
stringstream ss(str);
cout << ss.str() <<endl;
ss << str;
cout << ss.str() <<endl;
}
output:
123
123
int main(){
string str = "123";
stringstream ss;
ss << str;
cout << ss.str() <<endl;
ss << str;
cout << ss.str() <<endl;
}
output:
123
123123