Install gcc-4.4.0-tdm-1-core-2.tar.gz
[msysgit.git] / mingw / lib / gcc / mingw32 / 4.3.3 / include / c++ / istream
blob8b87c73fc1bddcbb8b895183dba132f64eb0ff7d
1 // Input streams -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008
5 // Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library.  This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2, or (at your option)
11 // any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this library; see the file COPYING.  If not, write to
20 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301, USA.
23 // As a special exception, you may use this file as part of a free software
24 // library without restriction.  Specifically, if other files instantiate
25 // templates or use macros or inline functions from this file, or you compile
26 // this file and link it with other files to produce an executable, this
27 // file does not by itself cause the resulting executable to be covered by
28 // the GNU General Public License.  This exception does not however
29 // invalidate any other reasons why the executable file might be covered by
30 // the GNU General Public License.
33 // ISO C++ 14882: 27.6.1  Input streams
36 /** @file istream
37  *  This is a Standard C++ Library header.
38  */
40 #ifndef _GLIBCXX_ISTREAM
41 #define _GLIBCXX_ISTREAM 1
43 #pragma GCC system_header
45 #include <ios>
46 #include <ostream>
48 _GLIBCXX_BEGIN_NAMESPACE(std)
50   // [27.6.1.1] Template class basic_istream
51   /**
52    *  @brief  Controlling input.
53    *
54    *  This is the base class for all input streams.  It provides text
55    *  formatting of all builtin types, and communicates with any class
56    *  derived from basic_streambuf to do the actual input.
57   */
58   template<typename _CharT, typename _Traits>
59     class basic_istream : virtual public basic_ios<_CharT, _Traits>
60     {
61     public:
62       // Types (inherited from basic_ios (27.4.4)):
63       typedef _CharT                                    char_type;
64       typedef typename _Traits::int_type                int_type;
65       typedef typename _Traits::pos_type                pos_type;
66       typedef typename _Traits::off_type                off_type;
67       typedef _Traits                                   traits_type;
68       
69       // Non-standard Types:
70       typedef basic_streambuf<_CharT, _Traits>          __streambuf_type;
71       typedef basic_ios<_CharT, _Traits>                __ios_type;
72       typedef basic_istream<_CharT, _Traits>            __istream_type;
73       typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >        
74                                                         __num_get_type;
75       typedef ctype<_CharT>                             __ctype_type;
77     protected:
78       // Data Members:
79       /**
80        *  The number of characters extracted in the previous unformatted
81        *  function; see gcount().
82       */
83       streamsize                _M_gcount;
85     public:
86       // [27.6.1.1.1] constructor/destructor
87       /**
88        *  @brief  Base constructor.
89        *
90        *  This ctor is almost never called by the user directly, rather from
91        *  derived classes' initialization lists, which pass a pointer to
92        *  their own stream buffer.
93       */
94       explicit
95       basic_istream(__streambuf_type* __sb)
96       : _M_gcount(streamsize(0))
97       { this->init(__sb); }
99       /**
100        *  @brief  Base destructor.
101        *
102        *  This does very little apart from providing a virtual base dtor.
103       */
104       virtual 
105       ~basic_istream() 
106       { _M_gcount = streamsize(0); }
108       // [27.6.1.1.2] prefix/suffix
109       class sentry;
110       friend class sentry;
112       // [27.6.1.2] formatted input
113       // [27.6.1.2.3] basic_istream::operator>>
114       //@{
115       /**
116        *  @brief  Interface for manipulators.
117        *
118        *  Manipulators such as @c std::ws and @c std::dec use these
119        *  functions in constructs like "std::cin >> std::ws".  For more
120        *  information, see the iomanip header.
121       */
122       __istream_type&
123       operator>>(__istream_type& (*__pf)(__istream_type&))
124       { return __pf(*this); }
126       __istream_type&
127       operator>>(__ios_type& (*__pf)(__ios_type&))
128       { 
129         __pf(*this);
130         return *this;
131       }
133       __istream_type&
134       operator>>(ios_base& (*__pf)(ios_base&))
135       {
136         __pf(*this);
137         return *this;
138       }
139       //@}
140       
141       // [27.6.1.2.2] arithmetic extractors
142       /**
143        *  @name Arithmetic Extractors
144        *
145        *  All the @c operator>> functions (aka <em>formatted input
146        *  functions</em>) have some common behavior.  Each starts by
147        *  constructing a temporary object of type std::basic_istream::sentry
148        *  with the second argument (noskipws) set to false.  This has several
149        *  effects, concluding with the setting of a status flag; see the
150        *  sentry documentation for more.
151        *
152        *  If the sentry status is good, the function tries to extract
153        *  whatever data is appropriate for the type of the argument.
154        *
155        *  If an exception is thrown during extraction, ios_base::badbit
156        *  will be turned on in the stream's error state without causing an
157        *  ios_base::failure to be thrown.  The original exception will then
158        *  be rethrown.
159       */
160       //@{
161       /**
162        *  @brief  Basic arithmetic extractors
163        *  @param  A variable of builtin type.
164        *  @return  @c *this if successful
165        *
166        *  These functions use the stream's current locale (specifically, the
167        *  @c num_get facet) to parse the input data.
168       */
169       __istream_type& 
170       operator>>(bool& __n)
171       { return _M_extract(__n); }
172       
173       __istream_type& 
174       operator>>(short& __n);
175       
176       __istream_type& 
177       operator>>(unsigned short& __n)
178       { return _M_extract(__n); }
180       __istream_type& 
181       operator>>(int& __n);
182     
183       __istream_type& 
184       operator>>(unsigned int& __n)
185       { return _M_extract(__n); }
187       __istream_type& 
188       operator>>(long& __n)
189       { return _M_extract(__n); }
190       
191       __istream_type& 
192       operator>>(unsigned long& __n)
193       { return _M_extract(__n); }
195 #ifdef _GLIBCXX_USE_LONG_LONG
196       __istream_type& 
197       operator>>(long long& __n)
198       { return _M_extract(__n); }
200       __istream_type& 
201       operator>>(unsigned long long& __n)
202       { return _M_extract(__n); }
203 #endif
205       __istream_type& 
206       operator>>(float& __f)
207       { return _M_extract(__f); }
209       __istream_type& 
210       operator>>(double& __f)
211       { return _M_extract(__f); }
213       __istream_type& 
214       operator>>(long double& __f)
215       { return _M_extract(__f); }
217       __istream_type& 
218       operator>>(void*& __p)
219       { return _M_extract(__p); }
221       /**
222        *  @brief  Extracting into another streambuf.
223        *  @param  sb  A pointer to a streambuf
224        *
225        *  This function behaves like one of the basic arithmetic extractors,
226        *  in that it also constructs a sentry object and has the same error
227        *  handling behavior.
228        *
229        *  If @a sb is NULL, the stream will set failbit in its error state.
230        *
231        *  Characters are extracted from this stream and inserted into the
232        *  @a sb streambuf until one of the following occurs:
233        *
234        *  - the input stream reaches end-of-file,
235        *  - insertion into the output buffer fails (in this case, the
236        *    character that would have been inserted is not extracted), or
237        *  - an exception occurs (and in this case is caught)
238        *
239        *  If the function inserts no characters, failbit is set.
240       */
241       __istream_type& 
242       operator>>(__streambuf_type* __sb);
243       //@}
244       
245       // [27.6.1.3] unformatted input
246       /**
247        *  @brief  Character counting
248        *  @return  The number of characters extracted by the previous
249        *           unformatted input function dispatched for this stream.
250       */
251       streamsize 
252       gcount() const 
253       { return _M_gcount; }
254       
255       /**
256        *  @name Unformatted Input Functions
257        *
258        *  All the unformatted input functions have some common behavior.
259        *  Each starts by constructing a temporary object of type
260        *  std::basic_istream::sentry with the second argument (noskipws)
261        *  set to true.  This has several effects, concluding with the
262        *  setting of a status flag; see the sentry documentation for more.
263        *
264        *  If the sentry status is good, the function tries to extract
265        *  whatever data is appropriate for the type of the argument.
266        *
267        *  The number of characters extracted is stored for later retrieval
268        *  by gcount().
269        *
270        *  If an exception is thrown during extraction, ios_base::badbit
271        *  will be turned on in the stream's error state without causing an
272        *  ios_base::failure to be thrown.  The original exception will then
273        *  be rethrown.
274       */
275       //@{
276       /**
277        *  @brief  Simple extraction.
278        *  @return  A character, or eof().
279        *
280        *  Tries to extract a character.  If none are available, sets failbit
281        *  and returns traits::eof().
282       */
283       int_type 
284       get();
286       /**
287        *  @brief  Simple extraction.
288        *  @param  c  The character in which to store data.
289        *  @return  *this
290        *
291        *  Tries to extract a character and store it in @a c.  If none are
292        *  available, sets failbit and returns traits::eof().
293        *
294        *  @note  This function is not overloaded on signed char and
295        *         unsigned char.
296       */
297       __istream_type& 
298       get(char_type& __c);
300       /**
301        *  @brief  Simple multiple-character extraction.
302        *  @param  s  Pointer to an array.
303        *  @param  n  Maximum number of characters to store in @a s.
304        *  @param  delim  A "stop" character.
305        *  @return  *this
306        *
307        *  Characters are extracted and stored into @a s until one of the
308        *  following happens:
309        *
310        *  - @c n-1 characters are stored
311        *  - the input sequence reaches EOF
312        *  - the next character equals @a delim, in which case the character
313        *    is not extracted
314        *
315        * If no characters are stored, failbit is set in the stream's error
316        * state.
317        *
318        * In any case, a null character is stored into the next location in
319        * the array.
320        *
321        *  @note  This function is not overloaded on signed char and
322        *         unsigned char.
323       */
324       __istream_type& 
325       get(char_type* __s, streamsize __n, char_type __delim);
327       /**
328        *  @brief  Simple multiple-character extraction.
329        *  @param  s  Pointer to an array.
330        *  @param  n  Maximum number of characters to store in @a s.
331        *  @return  *this
332        *
333        *  Returns @c get(s,n,widen('\n')).
334       */
335       __istream_type& 
336       get(char_type* __s, streamsize __n)
337       { return this->get(__s, __n, this->widen('\n')); }
339       /**
340        *  @brief  Extraction into another streambuf.
341        *  @param  sb  A streambuf in which to store data.
342        *  @param  delim  A "stop" character.
343        *  @return  *this
344        *
345        *  Characters are extracted and inserted into @a sb until one of the
346        *  following happens:
347        *
348        *  - the input sequence reaches EOF
349        *  - insertion into the output buffer fails (in this case, the
350        *    character that would have been inserted is not extracted)
351        *  - the next character equals @a delim (in this case, the character
352        *    is not extracted)
353        *  - an exception occurs (and in this case is caught)
354        *
355        * If no characters are stored, failbit is set in the stream's error
356        * state.
357       */
358       __istream_type&
359       get(__streambuf_type& __sb, char_type __delim);
361       /**
362        *  @brief  Extraction into another streambuf.
363        *  @param  sb  A streambuf in which to store data.
364        *  @return  *this
365        *
366        *  Returns @c get(sb,widen('\n')).
367       */
368       __istream_type&
369       get(__streambuf_type& __sb)
370       { return this->get(__sb, this->widen('\n')); }
372       /**
373        *  @brief  String extraction.
374        *  @param  s  A character array in which to store the data.
375        *  @param  n  Maximum number of characters to extract.
376        *  @param  delim  A "stop" character.
377        *  @return  *this
378        *
379        *  Extracts and stores characters into @a s until one of the
380        *  following happens.  Note that these criteria are required to be
381        *  tested in the order listed here, to allow an input line to exactly
382        *  fill the @a s array without setting failbit.
383        *
384        *  -# the input sequence reaches end-of-file, in which case eofbit
385        *     is set in the stream error state
386        *  -# the next character equals @c delim, in which case the character
387        *     is extracted (and therefore counted in @c gcount()) but not stored
388        *  -# @c n-1 characters are stored, in which case failbit is set
389        *     in the stream error state
390        *
391        *  If no characters are extracted, failbit is set.  (An empty line of
392        *  input should therefore not cause failbit to be set.)
393        *
394        *  In any case, a null character is stored in the next location in
395        *  the array.
396       */
397       __istream_type& 
398       getline(char_type* __s, streamsize __n, char_type __delim);
400       /**
401        *  @brief  String extraction.
402        *  @param  s  A character array in which to store the data.
403        *  @param  n  Maximum number of characters to extract.
404        *  @return  *this
405        *
406        *  Returns @c getline(s,n,widen('\n')).
407       */
408       __istream_type& 
409       getline(char_type* __s, streamsize __n)
410       { return this->getline(__s, __n, this->widen('\n')); }
412       /**
413        *  @brief  Discarding characters
414        *  @param  n  Number of characters to discard.
415        *  @param  delim  A "stop" character.
416        *  @return  *this
417        *
418        *  Extracts characters and throws them away until one of the
419        *  following happens:
420        *  - if @a n @c != @c std::numeric_limits<int>::max(), @a n
421        *    characters are extracted
422        *  - the input sequence reaches end-of-file
423        *  - the next character equals @a delim (in this case, the character
424        *    is extracted); note that this condition will never occur if
425        *    @a delim equals @c traits::eof().
426        *
427        *  NB: Provide three overloads, instead of the single function
428        *  (with defaults) mandated by the Standard: this leads to a
429        *  better performing implementation, while still conforming to
430        *  the Standard.
431       */
432       __istream_type& 
433       ignore();
435       __istream_type& 
436       ignore(streamsize __n);
438       __istream_type& 
439       ignore(streamsize __n, int_type __delim);
440       
441       /**
442        *  @brief  Looking ahead in the stream
443        *  @return  The next character, or eof().
444        *
445        *  If, after constructing the sentry object, @c good() is false,
446        *  returns @c traits::eof().  Otherwise reads but does not extract
447        *  the next input character.
448       */
449       int_type 
450       peek();
451       
452       /**
453        *  @brief  Extraction without delimiters.
454        *  @param  s  A character array.
455        *  @param  n  Maximum number of characters to store.
456        *  @return  *this
457        *
458        *  If the stream state is @c good(), extracts characters and stores
459        *  them into @a s until one of the following happens:
460        *  - @a n characters are stored
461        *  - the input sequence reaches end-of-file, in which case the error
462        *    state is set to @c failbit|eofbit.
463        *
464        *  @note  This function is not overloaded on signed char and
465        *         unsigned char.
466       */
467       __istream_type& 
468       read(char_type* __s, streamsize __n);
470       /**
471        *  @brief  Extraction until the buffer is exhausted, but no more.
472        *  @param  s  A character array.
473        *  @param  n  Maximum number of characters to store.
474        *  @return  The number of characters extracted.
475        *
476        *  Extracts characters and stores them into @a s depending on the
477        *  number of characters remaining in the streambuf's buffer,
478        *  @c rdbuf()->in_avail(), called @c A here:
479        *  - if @c A @c == @c -1, sets eofbit and extracts no characters
480        *  - if @c A @c == @c 0, extracts no characters
481        *  - if @c A @c > @c 0, extracts @c min(A,n)
482        *
483        *  The goal is to empty the current buffer, and to not request any
484        *  more from the external input sequence controlled by the streambuf.
485       */
486       streamsize 
487       readsome(char_type* __s, streamsize __n);
488       
489       /**
490        *  @brief  Unextracting a single character.
491        *  @param  c  The character to push back into the input stream.
492        *  @return  *this
493        *
494        *  If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c).
495        *
496        *  If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in
497        *  the error state.
498        *
499        *  @note  Since no characters are extracted, the next call to
500        *         @c gcount() will return 0, as required by DR 60.
501       */
502       __istream_type& 
503       putback(char_type __c);
505       /**
506        *  @brief  Unextracting the previous character.
507        *  @return  *this
508        *
509        *  If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c).
510        *
511        *  If @c rdbuf() is null or if @c sungetc() fails, sets badbit in
512        *  the error state.
513        *
514        *  @note  Since no characters are extracted, the next call to
515        *         @c gcount() will return 0, as required by DR 60.
516       */
517       __istream_type& 
518       unget();
520       /**
521        *  @brief  Synchronizing the stream buffer.
522        *  @return  0 on success, -1 on failure
523        *
524        *  If @c rdbuf() is a null pointer, returns -1.
525        *
526        *  Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1,
527        *  sets badbit and returns -1.
528        *
529        *  Otherwise, returns 0.
530        *
531        *  @note  This function does not count the number of characters
532        *         extracted, if any, and therefore does not affect the next
533        *         call to @c gcount().
534       */
535       int 
536       sync();
538       /**
539        *  @brief  Getting the current read position.
540        *  @return  A file position object.
541        *
542        *  If @c fail() is not false, returns @c pos_type(-1) to indicate
543        *  failure.  Otherwise returns @c rdbuf()->pubseekoff(0,cur,in).
544        *
545        *  @note  This function does not count the number of characters
546        *         extracted, if any, and therefore does not affect the next
547        *         call to @c gcount().
548       */
549       pos_type 
550       tellg();
552       /**
553        *  @brief  Changing the current read position.
554        *  @param  pos  A file position object.
555        *  @return  *this
556        *
557        *  If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos).  If
558        *  that function fails, sets failbit.
559        *
560        *  @note  This function does not count the number of characters
561        *         extracted, if any, and therefore does not affect the next
562        *         call to @c gcount().
563       */
564       __istream_type& 
565       seekg(pos_type);
567       /**
568        *  @brief  Changing the current read position.
569        *  @param  off  A file offset object.
570        *  @param  dir  The direction in which to seek.
571        *  @return  *this
572        *
573        *  If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir).
574        *  If that function fails, sets failbit.
575        *
576        *  @note  This function does not count the number of characters
577        *         extracted, if any, and therefore does not affect the next
578        *         call to @c gcount().
579       */
580       __istream_type& 
581       seekg(off_type, ios_base::seekdir);
582       //@}
584     protected:
585       basic_istream()
586       : _M_gcount(streamsize(0))
587       { this->init(0); }
589       template<typename _ValueT>
590         __istream_type&
591         _M_extract(_ValueT& __v);
592     };
594   // Explicit specialization declarations, defined in src/istream.cc.
595   template<> 
596     basic_istream<char>& 
597     basic_istream<char>::
598     getline(char_type* __s, streamsize __n, char_type __delim);
599   
600   template<>
601     basic_istream<char>&
602     basic_istream<char>::
603     ignore(streamsize __n);
604   
605   template<>
606     basic_istream<char>&
607     basic_istream<char>::
608     ignore(streamsize __n, int_type __delim);
610 #ifdef _GLIBCXX_USE_WCHAR_T
611   template<> 
612     basic_istream<wchar_t>& 
613     basic_istream<wchar_t>::
614     getline(char_type* __s, streamsize __n, char_type __delim);
616   template<>
617     basic_istream<wchar_t>&
618     basic_istream<wchar_t>::
619     ignore(streamsize __n);
620   
621   template<>
622     basic_istream<wchar_t>&
623     basic_istream<wchar_t>::
624     ignore(streamsize __n, int_type __delim);
625 #endif
627   /**
628    *  @brief  Performs setup work for input streams.
629    *
630    *  Objects of this class are created before all of the standard
631    *  extractors are run.  It is responsible for "exception-safe prefix and
632    *  suffix operations," although only prefix actions are currently required
633    *  by the standard. 
634   */
635   template<typename _CharT, typename _Traits>
636     class basic_istream<_CharT, _Traits>::sentry
637     {
638     public:
639       /// Easy access to dependant types.
640       typedef _Traits                                   traits_type;
641       typedef basic_streambuf<_CharT, _Traits>          __streambuf_type;
642       typedef basic_istream<_CharT, _Traits>            __istream_type;
643       typedef typename __istream_type::__ctype_type     __ctype_type;
644       typedef typename _Traits::int_type                __int_type;
646       /**
647        *  @brief  The constructor performs all the work.
648        *  @param  is  The input stream to guard.
649        *  @param  noskipws  Whether to consume whitespace or not.
650        *
651        *  If the stream state is good (@a is.good() is true), then the
652        *  following actions are performed, otherwise the sentry state is
653        *  false ("not okay") and failbit is set in the stream state.
654        *
655        *  The sentry's preparatory actions are:
656        *
657        *  -# if the stream is tied to an output stream, @c is.tie()->flush()
658        *     is called to synchronize the output sequence
659        *  -# if @a noskipws is false, and @c ios_base::skipws is set in
660        *     @c is.flags(), the sentry extracts and discards whitespace
661        *     characters from the stream.  The currently imbued locale is
662        *     used to determine whether each character is whitespace.
663        *
664        *  If the stream state is still good, then the sentry state becomes
665        *  true ("okay").
666       */
667       explicit
668       sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
670       /**
671        *  @brief  Quick status checking.
672        *  @return  The sentry state.
673        *
674        *  For ease of use, sentries may be converted to booleans.  The
675        *  return value is that of the sentry state (true == okay).
676       */
677       operator bool() const
678       { return _M_ok; }
680     private:
681       bool _M_ok;
682     };
684   // [27.6.1.2.3] character extraction templates
685   //@{
686   /**
687    *  @brief  Character extractors
688    *  @param  in  An input stream.
689    *  @param  c  A character reference.
690    *  @return  in
691    *
692    *  Behaves like one of the formatted arithmetic extractors described in
693    *  std::basic_istream.  After constructing a sentry object with good
694    *  status, this function extracts a character (if one is available) and
695    *  stores it in @a c.  Otherwise, sets failbit in the input stream.
696   */
697   template<typename _CharT, typename _Traits>
698     basic_istream<_CharT, _Traits>&
699     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
701   template<class _Traits>
702     inline basic_istream<char, _Traits>&
703     operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
704     { return (__in >> reinterpret_cast<char&>(__c)); }
706   template<class _Traits>
707     inline basic_istream<char, _Traits>&
708     operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
709     { return (__in >> reinterpret_cast<char&>(__c)); }
710   //@}
712   //@{
713   /**
714    *  @brief  Character string extractors
715    *  @param  in  An input stream.
716    *  @param  s  A pointer to a character array.
717    *  @return  in
718    *
719    *  Behaves like one of the formatted arithmetic extractors described in
720    *  std::basic_istream.  After constructing a sentry object with good
721    *  status, this function extracts up to @c n characters and stores them
722    *  into the array starting at @a s.  @c n is defined as:
723    *
724    *  - if @c width() is greater than zero, @c n is width()
725    *  - otherwise @c n is "the number of elements of the largest array of
726    *    @c char_type that can store a terminating @c eos." [27.6.1.2.3]/6
727    *
728    *  Characters are extracted and stored until one of the following happens:
729    *  - @c n-1 characters are stored
730    *  - EOF is reached
731    *  - the next character is whitespace according to the current locale
732    *  - the next character is a null byte (i.e., @c charT() )
733    *
734    *  @c width(0) is then called for the input stream.
735    *
736    *  If no characters are extracted, sets failbit.
737   */
738   template<typename _CharT, typename _Traits>
739     basic_istream<_CharT, _Traits>&
740     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
742   // Explicit specialization declaration, defined in src/istream.cc.
743   template<>
744     basic_istream<char>&
745     operator>>(basic_istream<char>& __in, char* __s);
747   template<class _Traits>
748     inline basic_istream<char, _Traits>&
749     operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
750     { return (__in >> reinterpret_cast<char*>(__s)); }
752   template<class _Traits>
753     inline basic_istream<char, _Traits>&
754     operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
755     { return (__in >> reinterpret_cast<char*>(__s)); }
756   //@}
758   // 27.6.1.5 Template class basic_iostream
759   /**
760    *  @brief  Merging istream and ostream capabilities.
761    *
762    *  This class multiply inherits from the input and output stream classes
763    *  simply to provide a single interface.
764   */
765   template<typename _CharT, typename _Traits>
766     class basic_iostream
767     : public basic_istream<_CharT, _Traits>, 
768       public basic_ostream<_CharT, _Traits>
769     {
770     public:
771       // _GLIBCXX_RESOLVE_LIB_DEFECTS
772       // 271. basic_iostream missing typedefs
773       // Types (inherited):
774       typedef _CharT                                    char_type;
775       typedef typename _Traits::int_type                int_type;
776       typedef typename _Traits::pos_type                pos_type;
777       typedef typename _Traits::off_type                off_type;
778       typedef _Traits                                   traits_type;
780       // Non-standard Types:
781       typedef basic_istream<_CharT, _Traits>            __istream_type;
782       typedef basic_ostream<_CharT, _Traits>            __ostream_type;
784       /**
785        *  @brief  Constructor does nothing.
786        *
787        *  Both of the parent classes are initialized with the same
788        *  streambuf pointer passed to this constructor.
789       */
790       explicit
791       basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
792       : __istream_type(__sb), __ostream_type(__sb) { }
794       /**
795        *  @brief  Destructor does nothing.
796       */
797       virtual 
798       ~basic_iostream() { }
800     protected:
801       basic_iostream()
802       : __istream_type(), __ostream_type() { }
803     };
805   // [27.6.1.4] standard basic_istream manipulators
806   /**
807    *  @brief  Quick and easy way to eat whitespace
808    *
809    *  This manipulator extracts whitespace characters, stopping when the
810    *  next character is non-whitespace, or when the input sequence is empty.
811    *  If the sequence is empty, @c eofbit is set in the stream, but not
812    *  @c failbit.
813    *
814    *  The current locale is used to distinguish whitespace characters.
815    *
816    *  Example:
817    *  @code
818    *     MyClass   mc;
819    *
820    *     std::cin >> std::ws >> mc;
821    *  @endcode
822    *  will skip leading whitespace before calling operator>> on cin and your
823    *  object.  Note that the same effect can be achieved by creating a
824    *  std::basic_istream::sentry inside your definition of operator>>.
825   */
826   template<typename _CharT, typename _Traits>
827     basic_istream<_CharT, _Traits>& 
828     ws(basic_istream<_CharT, _Traits>& __is);
830 _GLIBCXX_END_NAMESPACE
832 #ifndef _GLIBCXX_EXPORT_TEMPLATE
833 # include <bits/istream.tcc>
834 #endif
836 #endif  /* _GLIBCXX_ISTREAM */