I thought that:
if (true) {execute this statement}
So how does if (std::cin >> X) execute as true when there is nothing
if (std::cin >> X)
std::cin is of type std::basic_istream which inherits from std::basic_ios, which has an operator : std::basic_ios::operator bool which is called when used in if statement.
std::cin
std::basic_istream