16,551
社区成员
发帖
与我相关
我的任务
分享
_Myt& operator<<(_Myt& (__cdecl *_Pfn)(_Myt&)) //这里的_Myt即是std::cout类型,参数类型是_Myt& (__cdecl*)(_Myt&),而std::endl确实是这个类型
{ // call basic_ostream manipulator
return ((*_Pfn)(*this)); //这里回调一下函数参数,*this作为endl函数的参数,就执行了下面这个函数
}
_CRTIMP2 inline basic_ostream<char, char_traits<char> >&
__cdecl endl(basic_ostream<char, char_traits<char> >& _Ostr) //*this传进来后_Ostr这个时刻就是std::cout
{ // insert newline and flush byte stream
_Ostr.put('\n'); //输出一个换行
_Ostr.flush();
return (_Ostr);
}
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>& (*_Pfn)(basic_ostream<_Elem, _Tr>&)
);
basic_ostream<_Elem, _Tr>& operator<<(
ios_base& (*_Pfn)(ios_base&)
);
basic_ostream<_Elem, _Tr>& operator<<(
basic_ios<_Elem, _Tr>& (*_Pfn)(basic_ios<_Elem, _Tr>&)
);
template class<_Elem, _Tr>
basic_ostream<_Elem, _Tr>& endl(
basic_ostream<_Elem, _Tr>& _Ostr
);basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>& (*_Pfn)(basic_ostream<_Elem, _Tr>&)
);