Scott Zhong wrote:
Hi Martin,

     I'm trying to understand ostream, where is the basic_ostream&
operator<< (short); (ostream, line 143) and basic_ostream& operator<<
(int); (ostream, line 149) function implemented?

The definition is outside the class and starts on line 260. Is this
what you're looking for?

$ svn cat http://svn.apache.org/repos/asf/incubator/stdcxx/trunk/include/ostream | cat -n | head -275 | tail -17
   259
   260  template<class _CharT, class _Traits>
   261  inline basic_ostream<_CharT, _Traits>&
   262  basic_ostream<_CharT, _Traits>::operator<< (short __val)
   263  {
   264      const int __bf = this->flags () & this->basefield;
   265
266 // make sure negative values format properly in non-decimal bases 267 // i.e., -1 must format as hex "ffff" when (sizeof (short) == 2), 268 // and not, for example, "ffffffff" in ILP32 (see lwg issue 117)
   269      const long __lval = !__bf || this->dec == __bf ?
270 long (__val) : long (_RWSTD_STATIC_CAST (unsigned short, __val));
   271
   272      return _RW::__rw_insert (*this, __lval);
   273  }
   274
   275

Martin

Reply via email to