libstdc++
streambuf
Go to the documentation of this file.
1 // Stream buffer classes -*- C++ -*-
2 
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11 
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
20 
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
25 
26 /** @file include/streambuf
27  * This is a Standard C++ Library header.
28  */
29 
30 //
31 // ISO C++ 14882: 27.5 Stream buffers
32 //
33 
34 #ifndef _GLIBXX_STREAMBUF
35 #define _GLIBXX_STREAMBUF 1
36 
37 #pragma GCC system_header
38 
39 #include <bits/c++config.h>
40 #include <iosfwd>
41 #include <bits/localefwd.h>
42 #include <bits/ios_base.h>
43 #include <bits/cpp_type_traits.h>
44 #include <ext/type_traits.h>
45 
46 namespace std _GLIBCXX_VISIBILITY(default)
47 {
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
49 
50  template<typename _CharT, typename _Traits>
52  __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
53  basic_streambuf<_CharT, _Traits>*, bool&);
54 
55  /**
56  * @brief The actual work of input and output (interface).
57  * @ingroup io
58  *
59  * This is a base class. Derived stream buffers each control a
60  * pair of character sequences: one for input, and one for output.
61  *
62  * Section [27.5.1] of the standard describes the requirements and
63  * behavior of stream buffer classes. That section (three paragraphs)
64  * is reproduced here, for simplicity and accuracy.
65  *
66  * -# Stream buffers can impose various constraints on the sequences
67  * they control. Some constraints are:
68  * - The controlled input sequence can be not readable.
69  * - The controlled output sequence can be not writable.
70  * - The controlled sequences can be associated with the contents of
71  * other representations for character sequences, such as external
72  * files.
73  * - The controlled sequences can support operations @e directly to or
74  * from associated sequences.
75  * - The controlled sequences can impose limitations on how the
76  * program can read characters from a sequence, write characters to
77  * a sequence, put characters back into an input sequence, or alter
78  * the stream position.
79  * .
80  * -# Each sequence is characterized by three pointers which, if non-null,
81  * all point into the same @c charT array object. The array object
82  * represents, at any moment, a (sub)sequence of characters from the
83  * sequence. Operations performed on a sequence alter the values
84  * stored in these pointers, perform reads and writes directly to or
85  * from associated sequences, and alter <em>the stream position</em> and
86  * conversion state as needed to maintain this subsequence relationship.
87  * The three pointers are:
88  * - the <em>beginning pointer</em>, or lowest element address in the
89  * array (called @e xbeg here);
90  * - the <em>next pointer</em>, or next element address that is a
91  * current candidate for reading or writing (called @e xnext here);
92  * - the <em>end pointer</em>, or first element address beyond the
93  * end of the array (called @e xend here).
94  * .
95  * -# The following semantic constraints shall always apply for any set
96  * of three pointers for a sequence, using the pointer names given
97  * immediately above:
98  * - If @e xnext is not a null pointer, then @e xbeg and @e xend shall
99  * also be non-null pointers into the same @c charT array, as
100  * described above; otherwise, @e xbeg and @e xend shall also be null.
101  * - If @e xnext is not a null pointer and @e xnext < @e xend for an
102  * output sequence, then a <em>write position</em> is available.
103  * In this case, @e *xnext shall be assignable as the next element
104  * to write (to put, or to store a character value, into the sequence).
105  * - If @e xnext is not a null pointer and @e xbeg < @e xnext for an
106  * input sequence, then a <em>putback position</em> is available.
107  * In this case, @e xnext[-1] shall have a defined value and is the
108  * next (preceding) element to store a character that is put back
109  * into the input sequence.
110  * - If @e xnext is not a null pointer and @e xnext< @e xend for an
111  * input sequence, then a <em>read position</em> is available.
112  * In this case, @e *xnext shall have a defined value and is the
113  * next element to read (to get, or to obtain a character value,
114  * from the sequence).
115  */
116  template<typename _CharT, typename _Traits>
118  {
119  public:
120  //@{
121  /**
122  * These are standard types. They permit a standardized way of
123  * referring to names of (or names dependant on) the template
124  * parameters, which are specific to the implementation.
125  */
126  typedef _CharT char_type;
127  typedef _Traits traits_type;
128  typedef typename traits_type::int_type int_type;
129  typedef typename traits_type::pos_type pos_type;
130  typedef typename traits_type::off_type off_type;
131  //@}
132 
133  //@{
134  /// This is a non-standard type.
136  //@}
137 
138  friend class basic_ios<char_type, traits_type>;
139  friend class basic_istream<char_type, traits_type>;
140  friend class basic_ostream<char_type, traits_type>;
143 
144  friend streamsize
145  __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&);
146 
147  template<bool _IsMove, typename _CharT2>
148  friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
149  _CharT2*>::__type
150  __copy_move_a2(istreambuf_iterator<_CharT2>,
151  istreambuf_iterator<_CharT2>, _CharT2*);
152 
153  template<typename _CharT2>
154  friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
157  const _CharT2&);
158 
159  template<typename _CharT2, typename _Traits2>
162 
163  template<typename _CharT2, typename _Traits2, typename _Alloc>
167 
168  template<typename _CharT2, typename _Traits2, typename _Alloc>
172 
173  protected:
174  //@{
175  /**
176  * This is based on _IO_FILE, just reordered to be more consistent,
177  * and is intended to be the most minimal abstraction for an
178  * internal buffer.
179  * - get == input == read
180  * - put == output == write
181  */
182  char_type* _M_in_beg; // Start of get area.
183  char_type* _M_in_cur; // Current read area.
184  char_type* _M_in_end; // End of get area.
185  char_type* _M_out_beg; // Start of put area.
186  char_type* _M_out_cur; // Current put area.
187  char_type* _M_out_end; // End of put area.
188 
189  /// Current locale setting.
191 
192  public:
193  /// Destructor deallocates no buffer space.
194  virtual
196  { }
197 
198  // [27.5.2.2.1] locales
199  /**
200  * @brief Entry point for imbue().
201  * @param loc The new locale.
202  * @return The previous locale.
203  *
204  * Calls the derived imbue(loc).
205  */
206  locale
207  pubimbue(const locale &__loc)
208  {
209  locale __tmp(this->getloc());
210  this->imbue(__loc);
211  _M_buf_locale = __loc;
212  return __tmp;
213  }
214 
215  /**
216  * @brief Locale access.
217  * @return The current locale in effect.
218  *
219  * If pubimbue(loc) has been called, then the most recent @c loc
220  * is returned. Otherwise the global locale in effect at the time
221  * of construction is returned.
222  */
223  locale
224  getloc() const
225  { return _M_buf_locale; }
226 
227  // [27.5.2.2.2] buffer management and positioning
228  //@{
229  /**
230  * @brief Entry points for derived buffer functions.
231  *
232  * The public versions of @c pubfoo dispatch to the protected
233  * derived @c foo member functions, passing the arguments (if any)
234  * and returning the result unchanged.
235  */
238  { return this->setbuf(__s, __n); }
239 
240  pos_type
241  pubseekoff(off_type __off, ios_base::seekdir __way,
242  ios_base::openmode __mode = ios_base::in | ios_base::out)
243  { return this->seekoff(__off, __way, __mode); }
244 
245  pos_type
247  ios_base::openmode __mode = ios_base::in | ios_base::out)
248  { return this->seekpos(__sp, __mode); }
249 
250  int
251  pubsync() { return this->sync(); }
252  //@}
253 
254  // [27.5.2.2.3] get area
255  /**
256  * @brief Looking ahead into the stream.
257  * @return The number of characters available.
258  *
259  * If a read position is available, returns the number of characters
260  * available for reading before the buffer must be refilled.
261  * Otherwise returns the derived @c showmanyc().
262  */
263  streamsize
265  {
266  const streamsize __ret = this->egptr() - this->gptr();
267  return __ret ? __ret : this->showmanyc();
268  }
269 
270  /**
271  * @brief Getting the next character.
272  * @return The next character, or eof.
273  *
274  * Calls @c sbumpc(), and if that function returns
275  * @c traits::eof(), so does this function. Otherwise, @c sgetc().
276  */
277  int_type
279  {
280  int_type __ret = traits_type::eof();
281  if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(),
282  __ret), true))
283  __ret = this->sgetc();
284  return __ret;
285  }
286 
287  /**
288  * @brief Getting the next character.
289  * @return The next character, or eof.
290  *
291  * If the input read position is available, returns that character
292  * and increments the read pointer, otherwise calls and returns
293  * @c uflow().
294  */
295  int_type
297  {
298  int_type __ret;
299  if (__builtin_expect(this->gptr() < this->egptr(), true))
300  {
301  __ret = traits_type::to_int_type(*this->gptr());
302  this->gbump(1);
303  }
304  else
305  __ret = this->uflow();
306  return __ret;
307  }
308 
309  /**
310  * @brief Getting the next character.
311  * @return The next character, or eof.
312  *
313  * If the input read position is available, returns that character,
314  * otherwise calls and returns @c underflow(). Does not move the
315  * read position after fetching the character.
316  */
317  int_type
319  {
320  int_type __ret;
321  if (__builtin_expect(this->gptr() < this->egptr(), true))
322  __ret = traits_type::to_int_type(*this->gptr());
323  else
324  __ret = this->underflow();
325  return __ret;
326  }
327 
328  /**
329  * @brief Entry point for xsgetn.
330  * @param s A buffer area.
331  * @param n A count.
332  *
333  * Returns xsgetn(s,n). The effect is to fill @a s[0] through
334  * @a s[n-1] with characters from the input sequence, if possible.
335  */
336  streamsize
338  { return this->xsgetn(__s, __n); }
339 
340  // [27.5.2.2.4] putback
341  /**
342  * @brief Pushing characters back into the input stream.
343  * @param c The character to push back.
344  * @return The previous character, if possible.
345  *
346  * Similar to sungetc(), but @a c is pushed onto the stream
347  * instead of <em>the previous character.</em> If successful,
348  * the next character fetched from the input stream will be @a
349  * c.
350  */
351  int_type
353  {
354  int_type __ret;
355  const bool __testpos = this->eback() < this->gptr();
356  if (__builtin_expect(!__testpos ||
357  !traits_type::eq(__c, this->gptr()[-1]), false))
358  __ret = this->pbackfail(traits_type::to_int_type(__c));
359  else
360  {
361  this->gbump(-1);
362  __ret = traits_type::to_int_type(*this->gptr());
363  }
364  return __ret;
365  }
366 
367  /**
368  * @brief Moving backwards in the input stream.
369  * @return The previous character, if possible.
370  *
371  * If a putback position is available, this function decrements
372  * the input pointer and returns that character. Otherwise,
373  * calls and returns pbackfail(). The effect is to @a unget
374  * the last character @a gotten.
375  */
376  int_type
378  {
379  int_type __ret;
380  if (__builtin_expect(this->eback() < this->gptr(), true))
381  {
382  this->gbump(-1);
383  __ret = traits_type::to_int_type(*this->gptr());
384  }
385  else
386  __ret = this->pbackfail();
387  return __ret;
388  }
389 
390  // [27.5.2.2.5] put area
391  /**
392  * @brief Entry point for all single-character output functions.
393  * @param c A character to output.
394  * @return @a c, if possible.
395  *
396  * One of two public output functions.
397  *
398  * If a write position is available for the output sequence (i.e.,
399  * the buffer is not full), stores @a c in that position, increments
400  * the position, and returns @c traits::to_int_type(c). If a write
401  * position is not available, returns @c overflow(c).
402  */
403  int_type
405  {
406  int_type __ret;
407  if (__builtin_expect(this->pptr() < this->epptr(), true))
408  {
409  *this->pptr() = __c;
410  this->pbump(1);
411  __ret = traits_type::to_int_type(__c);
412  }
413  else
414  __ret = this->overflow(traits_type::to_int_type(__c));
415  return __ret;
416  }
417 
418  /**
419  * @brief Entry point for all single-character output functions.
420  * @param s A buffer read area.
421  * @param n A count.
422  *
423  * One of two public output functions.
424  *
425  *
426  * Returns xsputn(s,n). The effect is to write @a s[0] through
427  * @a s[n-1] to the output sequence, if possible.
428  */
429  streamsize
430  sputn(const char_type* __s, streamsize __n)
431  { return this->xsputn(__s, __n); }
432 
433  protected:
434  /**
435  * @brief Base constructor.
436  *
437  * Only called from derived constructors, and sets up all the
438  * buffer data to zero, including the pointers described in the
439  * basic_streambuf class description. Note that, as a result,
440  * - the class starts with no read nor write positions available,
441  * - this is not an error
442  */
444  : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
445  _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
447  { }
448 
449  // [27.5.2.3.1] get area access
450  //@{
451  /**
452  * @brief Access to the get area.
453  *
454  * These functions are only available to other protected functions,
455  * including derived classes.
456  *
457  * - eback() returns the beginning pointer for the input sequence
458  * - gptr() returns the next pointer for the input sequence
459  * - egptr() returns the end pointer for the input sequence
460  */
461  char_type*
462  eback() const { return _M_in_beg; }
463 
464  char_type*
465  gptr() const { return _M_in_cur; }
466 
467  char_type*
468  egptr() const { return _M_in_end; }
469  //@}
470 
471  /**
472  * @brief Moving the read position.
473  * @param n The delta by which to move.
474  *
475  * This just advances the read position without returning any data.
476  */
477  void
478  gbump(int __n) { _M_in_cur += __n; }
479 
480  /**
481  * @brief Setting the three read area pointers.
482  * @param gbeg A pointer.
483  * @param gnext A pointer.
484  * @param gend A pointer.
485  * @post @a gbeg == @c eback(), @a gnext == @c gptr(), and
486  * @a gend == @c egptr()
487  */
488  void
489  setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
490  {
491  _M_in_beg = __gbeg;
492  _M_in_cur = __gnext;
493  _M_in_end = __gend;
494  }
495 
496  // [27.5.2.3.2] put area access
497  //@{
498  /**
499  * @brief Access to the put area.
500  *
501  * These functions are only available to other protected functions,
502  * including derived classes.
503  *
504  * - pbase() returns the beginning pointer for the output sequence
505  * - pptr() returns the next pointer for the output sequence
506  * - epptr() returns the end pointer for the output sequence
507  */
508  char_type*
509  pbase() const { return _M_out_beg; }
510 
511  char_type*
512  pptr() const { return _M_out_cur; }
513 
514  char_type*
515  epptr() const { return _M_out_end; }
516  //@}
517 
518  /**
519  * @brief Moving the write position.
520  * @param n The delta by which to move.
521  *
522  * This just advances the write position without returning any data.
523  */
524  void
525  pbump(int __n) { _M_out_cur += __n; }
526 
527  /**
528  * @brief Setting the three write area pointers.
529  * @param pbeg A pointer.
530  * @param pend A pointer.
531  * @post @a pbeg == @c pbase(), @a pbeg == @c pptr(), and
532  * @a pend == @c epptr()
533  */
534  void
535  setp(char_type* __pbeg, char_type* __pend)
536  {
537  _M_out_beg = _M_out_cur = __pbeg;
538  _M_out_end = __pend;
539  }
540 
541  // [27.5.2.4] virtual functions
542  // [27.5.2.4.1] locales
543  /**
544  * @brief Changes translations.
545  * @param loc A new locale.
546  *
547  * Translations done during I/O which depend on the current
548  * locale are changed by this call. The standard adds,
549  * <em>Between invocations of this function a class derived
550  * from streambuf can safely cache results of calls to locale
551  * functions and to members of facets so obtained.</em>
552  *
553  * @note Base class version does nothing.
554  */
555  virtual void
556  imbue(const locale&)
557  { }
558 
559  // [27.5.2.4.2] buffer management and positioning
560  /**
561  * @brief Manipulates the buffer.
562  *
563  * Each derived class provides its own appropriate behavior. See
564  * the next-to-last paragraph of
565  * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html
566  * for more on this function.
567  *
568  * @note Base class version does nothing, returns @c this.
569  */
572  { return this; }
573 
574  /**
575  * @brief Alters the stream positions.
576  *
577  * Each derived class provides its own appropriate behavior.
578  * @note Base class version does nothing, returns a @c pos_type
579  * that represents an invalid stream position.
580  */
581  virtual pos_type
582  seekoff(off_type, ios_base::seekdir,
583  ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)
584  { return pos_type(off_type(-1)); }
585 
586  /**
587  * @brief Alters the stream positions.
588  *
589  * Each derived class provides its own appropriate behavior.
590  * @note Base class version does nothing, returns a @c pos_type
591  * that represents an invalid stream position.
592  */
593  virtual pos_type
595  ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)
596  { return pos_type(off_type(-1)); }
597 
598  /**
599  * @brief Synchronizes the buffer arrays with the controlled sequences.
600  * @return -1 on failure.
601  *
602  * Each derived class provides its own appropriate behavior,
603  * including the definition of @a failure.
604  * @note Base class version does nothing, returns zero.
605  */
606  virtual int
607  sync() { return 0; }
608 
609  // [27.5.2.4.3] get area
610  /**
611  * @brief Investigating the data available.
612  * @return An estimate of the number of characters available in the
613  * input sequence, or -1.
614  *
615  * <em>If it returns a positive value, then successive calls to
616  * @c underflow() will not return @c traits::eof() until at
617  * least that number of characters have been supplied. If @c
618  * showmanyc() returns -1, then calls to @c underflow() or @c
619  * uflow() will fail.</em> [27.5.2.4.3]/1
620  *
621  * @note Base class version does nothing, returns zero.
622  * @note The standard adds that <em>the intention is not only that the
623  * calls [to underflow or uflow] will not return @c eof() but
624  * that they will return immediately.</em>
625  * @note The standard adds that <em>the morphemes of @c showmanyc are
626  * @b es-how-many-see, not @b show-manic.</em>
627  */
628  virtual streamsize
629  showmanyc() { return 0; }
630 
631  /**
632  * @brief Multiple character extraction.
633  * @param s A buffer area.
634  * @param n Maximum number of characters to assign.
635  * @return The number of characters assigned.
636  *
637  * Fills @a s[0] through @a s[n-1] with characters from the input
638  * sequence, as if by @c sbumpc(). Stops when either @a n characters
639  * have been copied, or when @c traits::eof() would be copied.
640  *
641  * It is expected that derived classes provide a more efficient
642  * implementation by overriding this definition.
643  */
644  virtual streamsize
645  xsgetn(char_type* __s, streamsize __n);
646 
647  /**
648  * @brief Fetches more data from the controlled sequence.
649  * @return The first character from the <em>pending sequence</em>.
650  *
651  * Informally, this function is called when the input buffer is
652  * exhausted (or does not exist, as buffering need not actually be
653  * done). If a buffer exists, it is @a refilled. In either case, the
654  * next available character is returned, or @c traits::eof() to
655  * indicate a null pending sequence.
656  *
657  * For a formal definition of the pending sequence, see a good text
658  * such as Langer & Kreft, or [27.5.2.4.3]/7-14.
659  *
660  * A functioning input streambuf can be created by overriding only
661  * this function (no buffer area will be used). For an example, see
662  * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25.html
663  *
664  * @note Base class version does nothing, returns eof().
665  */
666  virtual int_type
668  { return traits_type::eof(); }
669 
670  /**
671  * @brief Fetches more data from the controlled sequence.
672  * @return The first character from the <em>pending sequence</em>.
673  *
674  * Informally, this function does the same thing as @c underflow(),
675  * and in fact is required to call that function. It also returns
676  * the new character, like @c underflow() does. However, this
677  * function also moves the read position forward by one.
678  */
679  virtual int_type
680  uflow()
681  {
682  int_type __ret = traits_type::eof();
683  const bool __testeof = traits_type::eq_int_type(this->underflow(),
684  __ret);
685  if (!__testeof)
686  {
687  __ret = traits_type::to_int_type(*this->gptr());
688  this->gbump(1);
689  }
690  return __ret;
691  }
692 
693  // [27.5.2.4.4] putback
694  /**
695  * @brief Tries to back up the input sequence.
696  * @param c The character to be inserted back into the sequence.
697  * @return eof() on failure, <em>some other value</em> on success
698  * @post The constraints of @c gptr(), @c eback(), and @c pptr()
699  * are the same as for @c underflow().
700  *
701  * @note Base class version does nothing, returns eof().
702  */
703  virtual int_type
704  pbackfail(int_type /* __c */ = traits_type::eof())
705  { return traits_type::eof(); }
706 
707  // Put area:
708  /**
709  * @brief Multiple character insertion.
710  * @param s A buffer area.
711  * @param n Maximum number of characters to write.
712  * @return The number of characters written.
713  *
714  * Writes @a s[0] through @a s[n-1] to the output sequence, as if
715  * by @c sputc(). Stops when either @a n characters have been
716  * copied, or when @c sputc() would return @c traits::eof().
717  *
718  * It is expected that derived classes provide a more efficient
719  * implementation by overriding this definition.
720  */
721  virtual streamsize
722  xsputn(const char_type* __s, streamsize __n);
723 
724  /**
725  * @brief Consumes data from the buffer; writes to the
726  * controlled sequence.
727  * @param c An additional character to consume.
728  * @return eof() to indicate failure, something else (usually
729  * @a c, or not_eof())
730  *
731  * Informally, this function is called when the output buffer
732  * is full (or does not exist, as buffering need not actually
733  * be done). If a buffer exists, it is @a consumed, with
734  * <em>some effect</em> on the controlled sequence.
735  * (Typically, the buffer is written out to the sequence
736  * verbatim.) In either case, the character @a c is also
737  * written out, if @a c is not @c eof().
738  *
739  * For a formal definition of this function, see a good text
740  * such as Langer & Kreft, or [27.5.2.4.5]/3-7.
741  *
742  * A functioning output streambuf can be created by overriding only
743  * this function (no buffer area will be used).
744  *
745  * @note Base class version does nothing, returns eof().
746  */
747  virtual int_type
748  overflow(int_type /* __c */ = traits_type::eof())
749  { return traits_type::eof(); }
750 
751 #if _GLIBCXX_USE_DEPRECATED
752  // Annex D.6
753  public:
754  /**
755  * @brief Tosses a character.
756  *
757  * Advances the read pointer, ignoring the character that would have
758  * been read.
759  *
760  * See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html
761  */
762  void
763  stossc()
764  {
765  if (this->gptr() < this->egptr())
766  this->gbump(1);
767  else
768  this->uflow();
769  }
770 #endif
771 
772  // Also used by specializations for char and wchar_t in src.
773  void
774  __safe_gbump(streamsize __n) { _M_in_cur += __n; }
775 
776  void
777  __safe_pbump(streamsize __n) { _M_out_cur += __n; }
778 
779  private:
780  // _GLIBCXX_RESOLVE_LIB_DEFECTS
781  // Side effect of DR 50.
782  basic_streambuf(const __streambuf_type& __sb)
783  : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
787  { }
788 
790  operator=(const __streambuf_type&) { return *this; };
791  };
792 
793  // Explicit specialization declarations, defined in src/streambuf.cc.
794  template<>
795  streamsize
796  __copy_streambufs_eof(basic_streambuf<char>* __sbin,
797  basic_streambuf<char>* __sbout, bool& __ineof);
798 #ifdef _GLIBCXX_USE_WCHAR_T
799  template<>
800  streamsize
801  __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin,
802  basic_streambuf<wchar_t>* __sbout, bool& __ineof);
803 #endif
804 
805 _GLIBCXX_END_NAMESPACE_VERSION
806 } // namespace
807 
808 #include <bits/streambuf.tcc>
809 
810 #endif /* _GLIBCXX_STREAMBUF */