Question about stringstream

Hi everyone,
An exercise's example says:

1
2
3
4
5
6
int sum_int(string cmd){
stringstream ss (cmd);

......

}

but what the line "stringstream ss (cmd);" means?

why is used the syntax ss(cmd)??

thank you !!
Last edited on
It creates a stringstream variable (object) named ss, and the string cmd is passed to the constructor. After this you can read from ss using >> the same way you read user input from cin, but the input instead comes from the string cmd.
Topic archived. No new replies allowed.