You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Scott Zhong <sc...@roguewave.com> on 2006/07/25 18:58:14 UTC
ostream
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 closest match is:
Ostream, line 145:
basic_ostream& operator<< (unsigned short __val) {
return *this << _RWSTD_STATIC_CAST (unsigned long, __val);
}
And
Ostream, line 151:
basic_ostream& operator<< (unsigned int __val) {
return *this << _RWSTD_STATIC_CAST (unsigned long, __val);
}
Thank you,
Yu (Scott) Zhong
Consulting Engineer
Rogue Wave Software, a Quovadxtm division
scottz@roguewave.com
ph: 303 545 3182
Re: ostream
Posted by Martin Sebor <se...@roguewave.com>.
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