Looking at istream
documentation, you will see that there is no implementation of function istream &operator>>( char& )
, but if you compile and run the code below, it will work just as expected.
#include<iostream>
int main( ) {
char c;
std::cin >> c;
std::cout << c << std::endl;
return( 0 );
}
Given cin
is an object for class istream, which specialization of operator>>
is called
when std::cin >> c;
is executed?
operator>>
also is implemented as non-member functions.As stated here,
operator>>
is also implemented as non-member-function of cin.Non-member function :
There is always the standard stated it explicitly in the section § 27.7.2.2.3 :