ostream.tcc

00001 // ostream classes -*- C++ -*- 00002 00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 00004 // Free Software Foundation, Inc. 00005 // 00006 // This file is part of the GNU ISO C++ Library. This library is free 00007 // software; you can redistribute it and/or modify it under the 00008 // terms of the GNU General Public License as published by the 00009 // Free Software Foundation; either version 2, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 00017 // You should have received a copy of the GNU General Public License along 00018 // with this library; see the file COPYING. If not, write to the Free 00019 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00020 // USA. 00021 00022 // As a special exception, you may use this file as part of a free software 00023 // library without restriction. Specifically, if other files instantiate 00024 // templates or use macros or inline functions from this file, or you compile 00025 // this file and link it with other files to produce an executable, this 00026 // file does not by itself cause the resulting executable to be covered by 00027 // the GNU General Public License. This exception does not however 00028 // invalidate any other reasons why the executable file might be covered by 00029 // the GNU General Public License. 00030 00031 // 00032 // ISO C++ 14882: 27.6.2 Output streams 00033 // 00034 00035 #pragma GCC system_header 00036 00037 #include <locale> 00038 00039 namespace std 00040 { 00041 template<typename _CharT, typename _Traits> 00042 basic_ostream<_CharT, _Traits>::sentry:: 00043 sentry(basic_ostream<_CharT, _Traits>& __os) 00044 : _M_os(__os) 00045 { 00046 // XXX MT 00047 if (__os.tie() && __os.good()) 00048 __os.tie()->flush(); 00049 00050 if (__os.good()) 00051 _M_ok = true; 00052 else 00053 { 00054 _M_ok = false; 00055 __os.setstate(ios_base::failbit); 00056 } 00057 } 00058 00059 template<typename _CharT, typename _Traits> 00060 basic_ostream<_CharT, _Traits>& 00061 basic_ostream<_CharT, _Traits>:: 00062 operator<<(__ostream_type& (*__pf)(__ostream_type&)) 00063 { 00064 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00065 // DR 60. What is a formatted input function? 00066 // The inserters for manipulators are *not* formatted output functions. 00067 return __pf(*this); 00068 } 00069 00070 template<typename _CharT, typename _Traits> 00071 basic_ostream<_CharT, _Traits>& 00072 basic_ostream<_CharT, _Traits>:: 00073 operator<<(__ios_type& (*__pf)(__ios_type&)) 00074 { 00075 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00076 // DR 60. What is a formatted input function? 00077 // The inserters for manipulators are *not* formatted output functions. 00078 __pf(*this); 00079 return *this; 00080 } 00081 00082 template<typename _CharT, typename _Traits> 00083 basic_ostream<_CharT, _Traits>& 00084 basic_ostream<_CharT, _Traits>:: 00085 operator<<(ios_base& (*__pf)(ios_base&)) 00086 { 00087 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00088 // DR 60. What is a formatted input function? 00089 // The inserters for manipulators are *not* formatted output functions. 00090 __pf(*this); 00091 return *this; 00092 } 00093 00094 template<typename _CharT, typename _Traits> 00095 basic_ostream<_CharT, _Traits>& 00096 basic_ostream<_CharT, _Traits>:: 00097 operator<<(bool __n) 00098 { 00099 sentry __cerb(*this); 00100 if (__cerb) 00101 { 00102 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00103 try 00104 { 00105 _M_check_facet(this->_M_fnumput); 00106 const __numput_type& __np = *this->_M_fnumput; 00107 if (__np.put(*this, *this, this->fill(), __n).failed()) 00108 __err |= ios_base::badbit; 00109 } 00110 catch(...) 00111 { this->_M_setstate(ios_base::badbit); } 00112 if (__err) 00113 this->setstate(__err); 00114 } 00115 return *this; 00116 } 00117 00118 template<typename _CharT, typename _Traits> 00119 basic_ostream<_CharT, _Traits>& 00120 basic_ostream<_CharT, _Traits>:: 00121 operator<<(long __n) 00122 { 00123 sentry __cerb(*this); 00124 if (__cerb) 00125 { 00126 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00127 try 00128 { 00129 bool __b = false; 00130 char_type __c = this->fill(); 00131 ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; 00132 _M_check_facet(this->_M_fnumput); 00133 const __numput_type& __np = *this->_M_fnumput; 00134 if ((__fmt & ios_base::oct) || (__fmt & ios_base::hex)) 00135 { 00136 unsigned long __l = static_cast<unsigned long>(__n); 00137 __b = __np.put(*this, *this, __c, __l).failed(); 00138 } 00139 else 00140 __b = __np.put(*this, *this, __c, __n).failed(); 00141 if (__b) 00142 __err |= ios_base::badbit; 00143 } 00144 catch(...) 00145 { this->_M_setstate(ios_base::badbit); } 00146 if (__err) 00147 this->setstate(__err); 00148 } 00149 return *this; 00150 } 00151 00152 template<typename _CharT, typename _Traits> 00153 basic_ostream<_CharT, _Traits>& 00154 basic_ostream<_CharT, _Traits>:: 00155 operator<<(unsigned long __n) 00156 { 00157 sentry __cerb(*this); 00158 if (__cerb) 00159 { 00160 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00161 try 00162 { 00163 _M_check_facet(this->_M_fnumput); 00164 const __numput_type& __np = *this->_M_fnumput; 00165 if (__np.put(*this, *this, this->fill(), __n).failed()) 00166 __err |= ios_base::badbit; 00167 } 00168 catch(...) 00169 { this->_M_setstate(ios_base::badbit); } 00170 if (__err) 00171 this->setstate(__err); 00172 } 00173 return *this; 00174 } 00175 00176 #ifdef _GLIBCPP_USE_LONG_LONG 00177 template<typename _CharT, typename _Traits> 00178 basic_ostream<_CharT, _Traits>& 00179 basic_ostream<_CharT, _Traits>:: 00180 operator<<(long long __n) 00181 { 00182 sentry __cerb(*this); 00183 if (__cerb) 00184 { 00185 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00186 try 00187 { 00188 bool __b = false; 00189 char_type __c = this->fill(); 00190 ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; 00191 _M_check_facet(this->_M_fnumput); 00192 const __numput_type& __np = *this->_M_fnumput; 00193 if ((__fmt & ios_base::oct) || (__fmt & ios_base::hex)) 00194 { 00195 unsigned long long __l; 00196 __l = static_cast<unsigned long long>(__n); 00197 __b = __np.put(*this, *this, __c, __l).failed(); 00198 } 00199 else 00200 __b = __np.put(*this, *this, __c, __n).failed(); 00201 if (__b) 00202 __err |= ios_base::badbit; 00203 } 00204 catch(...) 00205 { this->_M_setstate(ios_base::badbit); } 00206 if (__err) 00207 this->setstate(__err); 00208 } 00209 return *this; 00210 } 00211 00212 template<typename _CharT, typename _Traits> 00213 basic_ostream<_CharT, _Traits>& 00214 basic_ostream<_CharT, _Traits>:: 00215 operator<<(unsigned long long __n) 00216 { 00217 sentry __cerb(*this); 00218 if (__cerb) 00219 { 00220 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00221 try 00222 { 00223 _M_check_facet(this->_M_fnumput); 00224 const __numput_type& __np = *this->_M_fnumput; 00225 if (__np.put(*this, *this, this->fill(), __n).failed()) 00226 __err |= ios_base::badbit; 00227 } 00228 catch(...) 00229 { this->_M_setstate(ios_base::badbit); } 00230 if (__err) 00231 this->setstate(__err); 00232 } 00233 return *this; 00234 } 00235 #endif 00236 00237 template<typename _CharT, typename _Traits> 00238 basic_ostream<_CharT, _Traits>& 00239 basic_ostream<_CharT, _Traits>:: 00240 operator<<(double __n) 00241 { 00242 sentry __cerb(*this); 00243 if (__cerb) 00244 { 00245 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00246 try 00247 { 00248 _M_check_facet(this->_M_fnumput); 00249 const __numput_type& __np = *this->_M_fnumput; 00250 if (__np.put(*this, *this, this->fill(), __n).failed()) 00251 __err |= ios_base::badbit; 00252 } 00253 catch(...) 00254 { this->_M_setstate(ios_base::badbit); } 00255 if (__err) 00256 this->setstate(__err); 00257 } 00258 return *this; 00259 } 00260 00261 template<typename _CharT, typename _Traits> 00262 basic_ostream<_CharT, _Traits>& 00263 basic_ostream<_CharT, _Traits>:: 00264 operator<<(long double __n) 00265 { 00266 sentry __cerb(*this); 00267 if (__cerb) 00268 { 00269 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00270 try 00271 { 00272 _M_check_facet(this->_M_fnumput); 00273 const __numput_type& __np = *this->_M_fnumput; 00274 if (__np.put(*this, *this, this->fill(), __n).failed()) 00275 __err |= ios_base::badbit; 00276 } 00277 catch(...) 00278 { this->_M_setstate(ios_base::badbit); } 00279 if (__err) 00280 this->setstate(__err); 00281 } 00282 return *this; 00283 } 00284 00285 template<typename _CharT, typename _Traits> 00286 basic_ostream<_CharT, _Traits>& 00287 basic_ostream<_CharT, _Traits>:: 00288 operator<<(const void* __n) 00289 { 00290 sentry __cerb(*this); 00291 if (__cerb) 00292 { 00293 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00294 try 00295 { 00296 _M_check_facet(this->_M_fnumput); 00297 const __numput_type& __np = *this->_M_fnumput; 00298 if (__np.put(*this, *this, this->fill(), __n).failed()) 00299 __err |= ios_base::badbit; 00300 } 00301 catch(...) 00302 { this->_M_setstate(ios_base::badbit); } 00303 if (__err) 00304 this->setstate(__err); 00305 } 00306 return *this; 00307 } 00308 00309 template<typename _CharT, typename _Traits> 00310 basic_ostream<_CharT, _Traits>& 00311 basic_ostream<_CharT, _Traits>:: 00312 operator<<(__streambuf_type* __sbin) 00313 { 00314 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00315 sentry __cerb(*this); 00316 if (__cerb && __sbin) 00317 { 00318 try 00319 { 00320 if (!__copy_streambufs(*this, __sbin, this->rdbuf())) 00321 __err |= ios_base::failbit; 00322 } 00323 catch(...) 00324 { this->_M_setstate(ios_base::failbit); } 00325 } 00326 else if (!__sbin) 00327 __err |= ios_base::badbit; 00328 if (__err) 00329 this->setstate(__err); 00330 return *this; 00331 } 00332 00333 template<typename _CharT, typename _Traits> 00334 basic_ostream<_CharT, _Traits>& 00335 basic_ostream<_CharT, _Traits>::put(char_type __c) 00336 { 00337 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00338 // DR 60. What is a formatted input function? 00339 // basic_ostream::put(char_type) is an unformatted output function. 00340 // DR 63. Exception-handling policy for unformatted output. 00341 // Unformatted output functions should catch exceptions thrown 00342 // from streambuf members. 00343 sentry __cerb(*this); 00344 if (__cerb) 00345 { 00346 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00347 try 00348 { 00349 int_type __put = this->rdbuf()->sputc(__c); 00350 if (traits_type::eq_int_type(__put, traits_type::eof())) 00351 __err |= ios_base::badbit; 00352 } 00353 catch (...) 00354 { this->_M_setstate(ios_base::badbit); } 00355 if (__err) 00356 this->setstate(__err); 00357 } 00358 return *this; 00359 } 00360 00361 template<typename _CharT, typename _Traits> 00362 basic_ostream<_CharT, _Traits>& 00363 basic_ostream<_CharT, _Traits>::write(const _CharT* __s, streamsize __n) 00364 { 00365 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00366 // DR 60. What is a formatted input function? 00367 // basic_ostream::write(const char_type*, streamsize) is an 00368 // unformatted output function. 00369 // DR 63. Exception-handling policy for unformatted output. 00370 // Unformatted output functions should catch exceptions thrown 00371 // from streambuf members. 00372 sentry __cerb(*this); 00373 if (__cerb) 00374 { 00375 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00376 try 00377 { 00378 streamsize __put = this->rdbuf()->sputn(__s, __n); 00379 if (__put != __n) 00380 __err |= ios_base::badbit; 00381 } 00382 catch (...) 00383 { this->_M_setstate(ios_base::badbit); } 00384 if (__err) 00385 this->setstate(__err); 00386 } 00387 return *this; 00388 } 00389 00390 template<typename _CharT, typename _Traits> 00391 basic_ostream<_CharT, _Traits>& 00392 basic_ostream<_CharT, _Traits>::flush() 00393 { 00394 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00395 // DR 60. What is a formatted input function? 00396 // basic_ostream::flush() is *not* an unformatted output function. 00397 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00398 try 00399 { 00400 if (this->rdbuf() && this->rdbuf()->pubsync() == -1) 00401 __err |= ios_base::badbit; 00402 } 00403 catch(...) 00404 { this->_M_setstate(ios_base::badbit); } 00405 if (__err) 00406 this->setstate(__err); 00407 return *this; 00408 } 00409 00410 template<typename _CharT, typename _Traits> 00411 typename basic_ostream<_CharT, _Traits>::pos_type 00412 basic_ostream<_CharT, _Traits>::tellp() 00413 { 00414 pos_type __ret = pos_type(-1); 00415 try 00416 { 00417 if (!this->fail()) 00418 __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); 00419 } 00420 catch(...) 00421 { this->_M_setstate(ios_base::badbit); } 00422 return __ret; 00423 } 00424 00425 00426 template<typename _CharT, typename _Traits> 00427 basic_ostream<_CharT, _Traits>& 00428 basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) 00429 { 00430 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00431 try 00432 { 00433 if (!this->fail()) 00434 { 00435 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00436 // 136. seekp, seekg setting wrong streams? 00437 pos_type __p = this->rdbuf()->pubseekpos(__pos, ios_base::out); 00438 00439 // 129. Need error indication from seekp() and seekg() 00440 if (__p == pos_type(off_type(-1))) 00441 __err |= ios_base::failbit; 00442 } 00443 } 00444 catch(...) 00445 { this->_M_setstate(ios_base::badbit); } 00446 if (__err) 00447 this->setstate(__err); 00448 return *this; 00449 } 00450 00451 template<typename _CharT, typename _Traits> 00452 basic_ostream<_CharT, _Traits>& 00453 basic_ostream<_CharT, _Traits>:: 00454 seekp(off_type __off, ios_base::seekdir __dir) 00455 { 00456 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); 00457 try 00458 { 00459 if (!this->fail()) 00460 { 00461 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00462 // 136. seekp, seekg setting wrong streams? 00463 pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, 00464 ios_base::out); 00465 00466 // 129. Need error indication from seekp() and seekg() 00467 if (__p == pos_type(off_type(-1))) 00468 __err |= ios_base::failbit; 00469 } 00470 } 00471 catch(...) 00472 { this->_M_setstate(ios_base::badbit); } 00473 if (__err) 00474 this->setstate(__err); 00475 return *this; 00476 } 00477 00478 // 27.6.2.5.4 Character inserters. 00479 template<typename _CharT, typename _Traits> 00480 basic_ostream<_CharT, _Traits>& 00481 operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) 00482 { 00483 typedef basic_ostream<_CharT, _Traits> __ostream_type; 00484 typename __ostream_type::sentry __cerb(__out); 00485 if (__cerb) 00486 { 00487 try 00488 { 00489 const streamsize __w = __out.width() > 0 ? __out.width() : 0; 00490 _CharT* __pads = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * (__w + 1))); 00491 __pads[0] = __c; 00492 streamsize __len = 1; 00493 if (__w > __len) 00494 { 00495 __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads, 00496 &__c, __w, __len, false); 00497 __len = __w; 00498 } 00499 __out.write(__pads, __len); 00500 __out.width(0); 00501 } 00502 catch(...) 00503 { __out._M_setstate(ios_base::badbit); } 00504 } 00505 return __out; 00506 } 00507 00508 // Specializations. 00509 template <class _Traits> 00510 basic_ostream<char, _Traits>& 00511 operator<<(basic_ostream<char, _Traits>& __out, char __c) 00512 { 00513 typedef basic_ostream<char, _Traits> __ostream_type; 00514 typename __ostream_type::sentry __cerb(__out); 00515 if (__cerb) 00516 { 00517 try 00518 { 00519 const streamsize __w = __out.width() > 0 ? __out.width() : 0; 00520 char* __pads = static_cast<char*>(__builtin_alloca(__w + 1)); 00521 __pads[0] = __c; 00522 streamsize __len = 1; 00523 if (__w > __len) 00524 { 00525 __pad<char, _Traits>::_S_pad(__out, __out.fill(), __pads, 00526 &__c, __w, __len, false); 00527 __len = __w; 00528 } 00529 __out.write(__pads, __len); 00530 __out.width(0); 00531 } 00532 catch(...) 00533 { __out._M_setstate(ios_base::badbit); } 00534 } 00535 return __out; 00536 } 00537 00538 template<typename _CharT, typename _Traits> 00539 basic_ostream<_CharT, _Traits>& 00540 operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) 00541 { 00542 typedef basic_ostream<_CharT, _Traits> __ostream_type; 00543 typename __ostream_type::sentry __cerb(__out); 00544 if (__cerb && __s) 00545 { 00546 try 00547 { 00548 const streamsize __w = __out.width() > 0 ? __out.width() : 0; 00549 _CharT* __pads = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); 00550 streamsize __len = static_cast<streamsize>(_Traits::length(__s)); 00551 if (__w > __len) 00552 { 00553 __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads, 00554 __s, __w, __len, false); 00555 __s = __pads; 00556 __len = __w; 00557 } 00558 __out.write(__s, __len); 00559 __out.width(0); 00560 } 00561 catch(...) 00562 { __out._M_setstate(ios_base::badbit); } 00563 } 00564 else if (!__s) 00565 __out.setstate(ios_base::badbit); 00566 return __out; 00567 } 00568 00569 template<typename _CharT, typename _Traits> 00570 basic_ostream<_CharT, _Traits>& 00571 operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) 00572 { 00573 typedef basic_ostream<_CharT, _Traits> __ostream_type; 00574 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS 00575 // 167. Improper use of traits_type::length() 00576 // Note that this is only in 'Review' status. 00577 typedef char_traits<char> __traits_type; 00578 #endif 00579 typename __ostream_type::sentry __cerb(__out); 00580 if (__cerb && __s) 00581 { 00582 size_t __clen = __traits_type::length(__s); 00583 _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * (__clen + 1))); 00584 for (size_t __i = 0; __i < __clen; ++__i) 00585 __ws[__i] = __out.widen(__s[__i]); 00586 _CharT* __str = __ws; 00587 00588 try 00589 { 00590 streamsize __len = static_cast<streamsize>(__clen); 00591 const streamsize __w = __out.width() > 0 ? __out.width() : 0; 00592 _CharT* __pads = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); 00593 00594 if (__w > __len) 00595 { 00596 __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads, 00597 __ws, __w, __len, false); 00598 __str = __pads; 00599 __len = __w; 00600 } 00601 __out.write(__str, __len); 00602 __out.width(0); 00603 } 00604 catch(...) 00605 { __out._M_setstate(ios_base::badbit); } 00606 } 00607 else if (!__s) 00608 __out.setstate(ios_base::badbit); 00609 return __out; 00610 } 00611 00612 // Partial specializations. 00613 template<class _Traits> 00614 basic_ostream<char, _Traits>& 00615 operator<<(basic_ostream<char, _Traits>& __out, const char* __s) 00616 { 00617 typedef basic_ostream<char, _Traits> __ostream_type; 00618 typename __ostream_type::sentry __cerb(__out); 00619 if (__cerb && __s) 00620 { 00621 try 00622 { 00623 const streamsize __w = __out.width() > 0 ? __out.width() : 0; 00624 char* __pads = static_cast<char*>(__builtin_alloca(__w)); 00625 streamsize __len = static_cast<streamsize>(_Traits::length(__s)); 00626 00627 if (__w > __len) 00628 { 00629 __pad<char, _Traits>::_S_pad(__out, __out.fill(), __pads, 00630 __s, __w, __len, false); 00631 __s = __pads; 00632 __len = __w; 00633 } 00634 __out.write(__s, __len); 00635 __out.width(0); 00636 } 00637 catch(...) 00638 { __out._M_setstate(ios_base::badbit); } 00639 } 00640 else if (!__s) 00641 __out.setstate(ios_base::badbit); 00642 return __out; 00643 } 00644 00645 // 21.3.7.9 basic_string::operator<< 00646 template<typename _CharT, typename _Traits, typename _Alloc> 00647 basic_ostream<_CharT, _Traits>& 00648 operator<<(basic_ostream<_CharT, _Traits>& __out, 00649 const basic_string<_CharT, _Traits, _Alloc>& __str) 00650 { 00651 typedef basic_ostream<_CharT, _Traits> __ostream_type; 00652 typename __ostream_type::sentry __cerb(__out); 00653 if (__cerb) 00654 { 00655 const _CharT* __s = __str.data(); 00656 const streamsize __w = __out.width() > 0 ? __out.width() : 0; 00657 _CharT* __pads = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); 00658 streamsize __len = static_cast<streamsize>(__str.size()); 00659 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS 00660 // 25. String operator<< uses width() value wrong 00661 #endif 00662 if (__w > __len) 00663 { 00664 __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __pads, __s, 00665 __w, __len, false); 00666 __s = __pads; 00667 __len = __w; 00668 } 00669 streamsize __res = __out.rdbuf()->sputn(__s, __len); 00670 __out.width(0); 00671 if (__res != __len) 00672 __out.setstate(ios_base::failbit); 00673 } 00674 return __out; 00675 } 00676 00677 // Inhibit implicit instantiations for required instantiations, 00678 // which are defined via explicit instantiations elsewhere. 00679 // NB: This syntax is a GNU extension. 00680 #if _GLIBCPP_EXTERN_TEMPLATE 00681 extern template class basic_ostream<char>; 00682 extern template ostream& endl(ostream&); 00683 extern template ostream& ends(ostream&); 00684 extern template ostream& flush(ostream&); 00685 extern template ostream& operator<<(ostream&, char); 00686 extern template ostream& operator<<(ostream&, unsigned char); 00687 extern template ostream& operator<<(ostream&, signed char); 00688 extern template ostream& operator<<(ostream&, const char*); 00689 extern template ostream& operator<<(ostream&, const unsigned char*); 00690 extern template ostream& operator<<(ostream&, const signed char*); 00691 00692 #ifdef _GLIBCPP_USE_WCHAR_T 00693 extern template class basic_ostream<wchar_t>; 00694 extern template wostream& endl(wostream&); 00695 extern template wostream& ends(wostream&); 00696 extern template wostream& flush(wostream&); 00697 extern template wostream& operator<<(wostream&, wchar_t); 00698 extern template wostream& operator<<(wostream&, char); 00699 extern template wostream& operator<<(wostream&, const wchar_t*); 00700 extern template wostream& operator<<(wostream&, const char*); 00701 #endif 00702 #endif 00703 } // namespace std

Generated on Sun Sep 19 16:33:53 2004 for libstdc++-v3 Source by doxygen 1.3.8