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