What is inside the if condition will be evaluated before bool .
if(cin >> X) means that if the condition is true , something was read on X ; if the condition is false , something else happened (for example, the thread ended) and X does not change.
eg. to read to the end of the stream, you can use while(cin >> X) .
source share