1 // File based streams -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4 // 2007, 2008, 2009, 2010
5 // Free Software Foundation, Inc.
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 3, or (at your option)
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 // Under Section 7 of GPL version 3, you are granted additional
19 // permissions described in the GCC Runtime Library Exception, version
20 // 3.1, as published by the Free Software Foundation.
22 // You should have received a copy of the GNU General Public License and
23 // a copy of the GCC Runtime Library Exception along with this program;
24 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 // <http://www.gnu.org/licenses/>.
28 * This is an internal header file, included by other library headers.
29 * You should not attempt to use it directly.
33 // ISO C++ 14882: 27.8 File-based streams
37 #define _FSTREAM_TCC 1
39 #pragma GCC system_header
41 #include <cxxabi-forced.h>
43 _GLIBCXX_BEGIN_NAMESPACE(std)
45 template<typename _CharT, typename _Traits>
47 basic_filebuf<_CharT, _Traits>::
48 _M_allocate_internal_buffer()
50 // Allocate internal buffer only if one doesn't already exist
51 // (either allocated or provided by the user via setbuf).
52 if (!_M_buf_allocated && !_M_buf)
54 _M_buf = new char_type[_M_buf_size];
55 _M_buf_allocated = true;
59 template<typename _CharT, typename _Traits>
61 basic_filebuf<_CharT, _Traits>::
62 _M_destroy_internal_buffer() throw()
68 _M_buf_allocated = false;
77 template<typename _CharT, typename _Traits>
78 basic_filebuf<_CharT, _Traits>::
79 basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
80 _M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(),
81 _M_state_last(), _M_buf(0), _M_buf_size(BUFSIZ),
82 _M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(),
83 _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false),
84 _M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0),
87 if (has_facet<__codecvt_type>(this->_M_buf_locale))
88 _M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale);
91 template<typename _CharT, typename _Traits>
92 typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
93 basic_filebuf<_CharT, _Traits>::
94 open(const char* __s, ios_base::openmode __mode)
96 __filebuf_type *__ret = 0;
99 _M_file.open(__s, __mode);
102 _M_allocate_internal_buffer();
105 // Setup initial buffer to 'uncommitted' mode.
110 // Reset to initial state.
111 _M_state_last = _M_state_cur = _M_state_beg;
114 if ((__mode & ios_base::ate)
115 && this->seekoff(0, ios_base::end, __mode)
116 == pos_type(off_type(-1)))
125 template<typename _CharT, typename _Traits>
126 typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
127 basic_filebuf<_CharT, _Traits>::
130 if (!this->is_open())
133 bool __testfail = false;
135 // NB: Do this here so that re-opened filebufs will be cool...
136 struct __close_sentry
139 __close_sentry (basic_filebuf *__fbi): __fb(__fbi) { }
142 __fb->_M_mode = ios_base::openmode(0);
143 __fb->_M_pback_init = false;
144 __fb->_M_destroy_internal_buffer();
145 __fb->_M_reading = false;
146 __fb->_M_writing = false;
147 __fb->_M_set_buffer(-1);
148 __fb->_M_state_last = __fb->_M_state_cur = __fb->_M_state_beg;
154 if (!_M_terminate_output())
157 __catch(__cxxabiv1::__forced_unwind&)
160 __throw_exception_again;
163 { __testfail = true; }
166 if (!_M_file.close())
175 template<typename _CharT, typename _Traits>
177 basic_filebuf<_CharT, _Traits>::
180 streamsize __ret = -1;
181 const bool __testin = _M_mode & ios_base::in;
182 if (__testin && this->is_open())
184 // For a stateful encoding (-1) the pending sequence might be just
185 // shift and unshift prefixes with no actual character.
186 __ret = this->egptr() - this->gptr();
188 #if _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM
189 // About this workaround, see libstdc++/20806.
190 const bool __testbinary = _M_mode & ios_base::binary;
191 if (__check_facet(_M_codecvt).encoding() >= 0
194 if (__check_facet(_M_codecvt).encoding() >= 0)
196 __ret += _M_file.showmanyc() / _M_codecvt->max_length();
201 template<typename _CharT, typename _Traits>
202 typename basic_filebuf<_CharT, _Traits>::int_type
203 basic_filebuf<_CharT, _Traits>::
206 int_type __ret = traits_type::eof();
207 const bool __testin = _M_mode & ios_base::in;
213 if (__ret == traits_type::eof())
218 // Check for pback madness, and if so switch back to the
219 // normal buffers and jet outta here before expensive
223 if (this->gptr() < this->egptr())
224 return traits_type::to_int_type(*this->gptr());
226 // Get and convert input sequence.
227 const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;
229 // Will be set to true if ::read() returns 0 indicating EOF.
230 bool __got_eof = false;
231 // Number of internal characters produced.
232 streamsize __ilen = 0;
233 codecvt_base::result __r = codecvt_base::ok;
234 if (__check_facet(_M_codecvt).always_noconv())
236 __ilen = _M_file.xsgetn(reinterpret_cast<char*>(this->eback()),
243 // Worst-case number of external bytes.
244 // XXX Not done encoding() == -1.
245 const int __enc = _M_codecvt->encoding();
246 streamsize __blen; // Minimum buffer size.
247 streamsize __rlen; // Number of chars to read.
249 __blen = __rlen = __buflen * __enc;
252 __blen = __buflen + _M_codecvt->max_length() - 1;
255 const streamsize __remainder = _M_ext_end - _M_ext_next;
256 __rlen = __rlen > __remainder ? __rlen - __remainder : 0;
258 // An imbue in 'read' mode implies first converting the external
259 // chars already present.
260 if (_M_reading && this->egptr() == this->eback() && __remainder)
263 // Allocate buffer if necessary and move unconverted
265 if (_M_ext_buf_size < __blen)
267 char* __buf = new char[__blen];
269 __builtin_memcpy(__buf, _M_ext_next, __remainder);
271 delete [] _M_ext_buf;
273 _M_ext_buf_size = __blen;
275 else if (__remainder)
276 __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder);
278 _M_ext_next = _M_ext_buf;
279 _M_ext_end = _M_ext_buf + __remainder;
280 _M_state_last = _M_state_cur;
287 // This may fail if the return value of
288 // codecvt::max_length() is bogus.
289 if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size)
291 __throw_ios_failure(__N("basic_filebuf::underflow "
292 "codecvt::max_length() "
295 streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen);
298 else if (__elen == -1)
300 _M_ext_end += __elen;
303 char_type* __iend = this->eback();
304 if (_M_ext_next < _M_ext_end)
305 __r = _M_codecvt->in(_M_state_cur, _M_ext_next,
306 _M_ext_end, _M_ext_next,
308 this->eback() + __buflen, __iend);
309 if (__r == codecvt_base::noconv)
311 size_t __avail = _M_ext_end - _M_ext_buf;
312 __ilen = std::min(__avail, __buflen);
313 traits_type::copy(this->eback(),
314 reinterpret_cast<char_type*>
315 (_M_ext_buf), __ilen);
316 _M_ext_next = _M_ext_buf + __ilen;
319 __ilen = __iend - this->eback();
321 // _M_codecvt->in may return error while __ilen > 0: this is
322 // ok, and actually occurs in case of mixed encodings (e.g.,
324 if (__r == codecvt_base::error)
329 while (__ilen == 0 && !__got_eof);
334 _M_set_buffer(__ilen);
336 __ret = traits_type::to_int_type(*this->gptr());
340 // If the actual end of file is reached, set 'uncommitted'
341 // mode, thus allowing an immediate write without an
345 // However, reaching it while looping on partial means that
346 // the file has got an incomplete character.
347 if (__r == codecvt_base::partial)
348 __throw_ios_failure(__N("basic_filebuf::underflow "
349 "incomplete character in file"));
351 else if (__r == codecvt_base::error)
352 __throw_ios_failure(__N("basic_filebuf::underflow "
353 "invalid byte sequence in file"));
355 __throw_ios_failure(__N("basic_filebuf::underflow "
356 "error reading the file"));
361 template<typename _CharT, typename _Traits>
362 typename basic_filebuf<_CharT, _Traits>::int_type
363 basic_filebuf<_CharT, _Traits>::
364 pbackfail(int_type __i)
366 int_type __ret = traits_type::eof();
367 const bool __testin = _M_mode & ios_base::in;
373 if (__ret == traits_type::eof())
378 // Remember whether the pback buffer is active, otherwise below
379 // we may try to store in it a second char (libstdc++/9761).
380 const bool __testpb = _M_pback_init;
381 const bool __testeof = traits_type::eq_int_type(__i, __ret);
383 if (this->eback() < this->gptr())
386 __tmp = traits_type::to_int_type(*this->gptr());
388 else if (this->seekoff(-1, ios_base::cur) != pos_type(off_type(-1)))
390 __tmp = this->underflow();
391 if (traits_type::eq_int_type(__tmp, __ret))
396 // At the beginning of the buffer, need to make a
397 // putback position available. But the seek may fail
398 // (f.i., at the beginning of a file, see
399 // libstdc++/9439) and in that case we return
400 // traits_type::eof().
404 // Try to put back __i into input sequence in one of three ways.
405 // Order these tests done in is unspecified by the standard.
406 if (!__testeof && traits_type::eq_int_type(__i, __tmp))
409 __ret = traits_type::not_eof(__i);
414 *this->gptr() = traits_type::to_char_type(__i);
421 template<typename _CharT, typename _Traits>
422 typename basic_filebuf<_CharT, _Traits>::int_type
423 basic_filebuf<_CharT, _Traits>::
424 overflow(int_type __c)
426 int_type __ret = traits_type::eof();
427 const bool __testeof = traits_type::eq_int_type(__c, __ret);
428 const bool __testout = _M_mode & ios_base::out;
434 const int __gptr_off = _M_get_ext_pos(_M_state_last);
435 if (_M_seek(__gptr_off, ios_base::cur, _M_state_last)
436 == pos_type(off_type(-1)))
439 if (this->pbase() < this->pptr())
441 // If appropriate, append the overflow char.
444 *this->pptr() = traits_type::to_char_type(__c);
448 // Convert pending sequence to external representation,
450 if (_M_convert_to_external(this->pbase(),
451 this->pptr() - this->pbase()))
454 __ret = traits_type::not_eof(__c);
457 else if (_M_buf_size > 1)
459 // Overflow in 'uncommitted' mode: set _M_writing, set
460 // the buffer to the initial 'write' mode, and put __c
466 *this->pptr() = traits_type::to_char_type(__c);
469 __ret = traits_type::not_eof(__c);
474 char_type __conv = traits_type::to_char_type(__c);
475 if (__testeof || _M_convert_to_external(&__conv, 1))
478 __ret = traits_type::not_eof(__c);
485 template<typename _CharT, typename _Traits>
487 basic_filebuf<_CharT, _Traits>::
488 _M_convert_to_external(_CharT* __ibuf, streamsize __ilen)
490 // Sizes of external and pending output.
493 if (__check_facet(_M_codecvt).always_noconv())
495 __elen = _M_file.xsputn(reinterpret_cast<char*>(__ibuf), __ilen);
500 // Worst-case number of external bytes needed.
501 // XXX Not done encoding() == -1.
502 streamsize __blen = __ilen * _M_codecvt->max_length();
503 char* __buf = static_cast<char*>(__builtin_alloca(__blen));
506 const char_type* __iend;
507 codecvt_base::result __r;
508 __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen,
509 __iend, __buf, __buf + __blen, __bend);
511 if (__r == codecvt_base::ok || __r == codecvt_base::partial)
512 __blen = __bend - __buf;
513 else if (__r == codecvt_base::noconv)
515 // Same as the always_noconv case above.
516 __buf = reinterpret_cast<char*>(__ibuf);
520 __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external "
521 "conversion error"));
523 __elen = _M_file.xsputn(__buf, __blen);
526 // Try once more for partial conversions.
527 if (__r == codecvt_base::partial && __elen == __plen)
529 const char_type* __iresume = __iend;
530 streamsize __rlen = this->pptr() - __iend;
531 __r = _M_codecvt->out(_M_state_cur, __iresume,
532 __iresume + __rlen, __iend, __buf,
533 __buf + __blen, __bend);
534 if (__r != codecvt_base::error)
536 __rlen = __bend - __buf;
537 __elen = _M_file.xsputn(__buf, __rlen);
541 __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external "
542 "conversion error"));
545 return __elen == __plen;
548 template<typename _CharT, typename _Traits>
550 basic_filebuf<_CharT, _Traits>::
551 xsgetn(_CharT* __s, streamsize __n)
553 // Clear out pback buffer before going on to the real deal...
554 streamsize __ret = 0;
557 if (__n > 0 && this->gptr() == this->eback())
559 *__s++ = *this->gptr();
567 // Optimization in the always_noconv() case, to be generalized in the
568 // future: when __n > __buflen we read directly instead of using the
569 // buffer repeatedly.
570 const bool __testin = _M_mode & ios_base::in;
571 const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;
573 if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()
574 && __testin && !_M_writing)
576 // First, copy the chars already present in the buffer.
577 const streamsize __avail = this->egptr() - this->gptr();
581 *__s = *this->gptr();
583 traits_type::copy(__s, this->gptr(), __avail);
585 this->gbump(__avail);
590 // Need to loop in case of short reads (relatively common
595 __len = _M_file.xsgetn(reinterpret_cast<char*>(__s),
598 __throw_ios_failure(__N("basic_filebuf::xsgetn "
599 "error reading the file"));
618 // If end of file is reached, set 'uncommitted'
619 // mode, thus allowing an immediate write without
620 // an intervening seek.
626 __ret += __streambuf_type::xsgetn(__s, __n);
631 template<typename _CharT, typename _Traits>
633 basic_filebuf<_CharT, _Traits>::
634 xsputn(const _CharT* __s, streamsize __n)
636 // Optimization in the always_noconv() case, to be generalized in the
637 // future: when __n is sufficiently large we write directly instead of
639 streamsize __ret = 0;
640 const bool __testout = _M_mode & ios_base::out;
641 if (__check_facet(_M_codecvt).always_noconv()
642 && __testout && !_M_reading)
644 // Measurement would reveal the best choice.
645 const streamsize __chunk = 1ul << 10;
646 streamsize __bufavail = this->epptr() - this->pptr();
648 // Don't mistake 'uncommitted' mode buffered with unbuffered.
649 if (!_M_writing && _M_buf_size > 1)
650 __bufavail = _M_buf_size - 1;
652 const streamsize __limit = std::min(__chunk, __bufavail);
655 const streamsize __buffill = this->pptr() - this->pbase();
656 const char* __buf = reinterpret_cast<const char*>(this->pbase());
657 __ret = _M_file.xsputn_2(__buf, __buffill,
658 reinterpret_cast<const char*>(__s),
660 if (__ret == __buffill + __n)
665 if (__ret > __buffill)
671 __ret = __streambuf_type::xsputn(__s, __n);
674 __ret = __streambuf_type::xsputn(__s, __n);
678 template<typename _CharT, typename _Traits>
679 typename basic_filebuf<_CharT, _Traits>::__streambuf_type*
680 basic_filebuf<_CharT, _Traits>::
681 setbuf(char_type* __s, streamsize __n)
683 if (!this->is_open())
685 if (__s == 0 && __n == 0)
687 else if (__s && __n > 0)
689 // This is implementation-defined behavior, and assumes that
690 // an external char_type array of length __n exists and has
691 // been pre-allocated. If this is not the case, things will
692 // quickly blow up. When __n > 1, __n - 1 positions will be
693 // used for the get area, __n - 1 for the put area and 1
694 // position to host the overflow char of a full put area.
695 // When __n == 1, 1 position will be used for the get area
696 // and 0 for the put area, as in the unbuffered case above.
705 // According to 27.8.1.4 p11 - 13, seekoff should ignore the last
706 // argument (of type openmode).
707 template<typename _CharT, typename _Traits>
708 typename basic_filebuf<_CharT, _Traits>::pos_type
709 basic_filebuf<_CharT, _Traits>::
710 seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode)
714 __width = _M_codecvt->encoding();
718 pos_type __ret = pos_type(off_type(-1));
719 const bool __testfail = __off != 0 && __width <= 0;
720 if (this->is_open() && !__testfail)
722 // tellg and tellp queries do not affect any state, unless
723 // ! always_noconv and the put sequence is not empty.
724 // In that case, determining the position requires converting the
725 // put sequence. That doesn't use ext_buf, so requires a flush.
726 bool __no_movement = __way == ios_base::cur && __off == 0
727 && (!_M_writing || _M_codecvt->always_noconv());
729 // Ditch any pback buffers to avoid confusion.
733 // Correct state at destination. Note that this is the correct
734 // state for the current position during output, because
735 // codecvt::unshift() returns the state to the initial state.
736 // This is also the correct state at the end of the file because
737 // an unshift sequence should have been written at the end.
738 __state_type __state = _M_state_beg;
739 off_type __computed_off = __off * __width;
740 if (_M_reading && __way == ios_base::cur)
742 __state = _M_state_last;
743 __computed_off += _M_get_ext_pos(__state);
746 __ret = _M_seek(__computed_off, __way, __state);
750 __computed_off = this->pptr() - this->pbase();
752 off_type __file_off = _M_file.seekoff(0, ios_base::cur);
753 if (__file_off != off_type(-1))
755 __ret = __file_off + __computed_off;
756 __ret.state(__state);
763 // _GLIBCXX_RESOLVE_LIB_DEFECTS
764 // 171. Strange seekpos() semantics due to joint position
765 // According to the resolution of DR 171, seekpos should ignore the last
766 // argument (of type openmode).
767 template<typename _CharT, typename _Traits>
768 typename basic_filebuf<_CharT, _Traits>::pos_type
769 basic_filebuf<_CharT, _Traits>::
770 seekpos(pos_type __pos, ios_base::openmode)
772 pos_type __ret = pos_type(off_type(-1));
775 // Ditch any pback buffers to avoid confusion.
777 __ret = _M_seek(off_type(__pos), ios_base::beg, __pos.state());
782 template<typename _CharT, typename _Traits>
783 typename basic_filebuf<_CharT, _Traits>::pos_type
784 basic_filebuf<_CharT, _Traits>::
785 _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state)
787 pos_type __ret = pos_type(off_type(-1));
788 if (_M_terminate_output())
790 off_type __file_off = _M_file.seekoff(__off, __way);
791 if (__file_off != off_type(-1))
795 _M_ext_next = _M_ext_end = _M_ext_buf;
797 _M_state_cur = __state;
799 __ret.state(_M_state_cur);
805 // Returns the distance from the end of the ext buffer to the point
806 // corresponding to gptr(). This is a negative value. Updates __state
807 // from eback() correspondence to gptr().
808 template<typename _CharT, typename _Traits>
809 int basic_filebuf<_CharT, _Traits>::
810 _M_get_ext_pos(__state_type& __state)
812 if (_M_codecvt->always_noconv())
813 return this->gptr() - this->egptr();
816 // Calculate offset from _M_ext_buf that corresponds to
817 // gptr(). Precondition: __state == _M_state_last, which
818 // corresponds to eback().
819 const int __gptr_off =
820 _M_codecvt->length(__state, _M_ext_buf, _M_ext_next,
821 this->gptr() - this->eback());
822 return _M_ext_buf + __gptr_off - _M_ext_end;
826 template<typename _CharT, typename _Traits>
828 basic_filebuf<_CharT, _Traits>::
829 _M_terminate_output()
831 // Part one: update the output sequence.
832 bool __testvalid = true;
833 if (this->pbase() < this->pptr())
835 const int_type __tmp = this->overflow();
836 if (traits_type::eq_int_type(__tmp, traits_type::eof()))
840 // Part two: output unshift sequence.
841 if (_M_writing && !__check_facet(_M_codecvt).always_noconv()
844 // Note: this value is arbitrary, since there is no way to
845 // get the length of the unshift sequence from codecvt,
846 // without calling unshift.
847 const size_t __blen = 128;
849 codecvt_base::result __r;
850 streamsize __ilen = 0;
855 __r = _M_codecvt->unshift(_M_state_cur, __buf,
856 __buf + __blen, __next);
857 if (__r == codecvt_base::error)
859 else if (__r == codecvt_base::ok ||
860 __r == codecvt_base::partial)
862 __ilen = __next - __buf;
865 const streamsize __elen = _M_file.xsputn(__buf, __ilen);
866 if (__elen != __ilen)
871 while (__r == codecvt_base::partial && __ilen > 0 && __testvalid);
875 // This second call to overflow() is required by the standard,
876 // but it's not clear why it's needed, since the output buffer
877 // should be empty by this point (it should have been emptied
878 // in the first call to overflow()).
879 const int_type __tmp = this->overflow();
880 if (traits_type::eq_int_type(__tmp, traits_type::eof()))
887 template<typename _CharT, typename _Traits>
889 basic_filebuf<_CharT, _Traits>::
892 // Make sure that the internal buffer resyncs its idea of
893 // the file position with the external file.
895 if (this->pbase() < this->pptr())
897 const int_type __tmp = this->overflow();
898 if (traits_type::eq_int_type(__tmp, traits_type::eof()))
904 template<typename _CharT, typename _Traits>
906 basic_filebuf<_CharT, _Traits>::
907 imbue(const locale& __loc)
909 bool __testvalid = true;
911 const __codecvt_type* _M_codecvt_tmp = 0;
912 if (__builtin_expect(has_facet<__codecvt_type>(__loc), true))
913 _M_codecvt_tmp = &use_facet<__codecvt_type>(__loc);
917 // encoding() == -1 is ok only at the beginning.
918 if ((_M_reading || _M_writing)
919 && __check_facet(_M_codecvt).encoding() == -1)
925 if (__check_facet(_M_codecvt).always_noconv())
928 && !__check_facet(_M_codecvt_tmp).always_noconv())
929 __testvalid = this->seekoff(0, ios_base::cur, _M_mode)
930 != pos_type(off_type(-1));
934 // External position corresponding to gptr().
935 _M_ext_next = _M_ext_buf
936 + _M_codecvt->length(_M_state_last, _M_ext_buf, _M_ext_next,
937 this->gptr() - this->eback());
938 const streamsize __remainder = _M_ext_end - _M_ext_next;
940 __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder);
942 _M_ext_next = _M_ext_buf;
943 _M_ext_end = _M_ext_buf + __remainder;
945 _M_state_last = _M_state_cur = _M_state_beg;
948 else if (_M_writing && (__testvalid = _M_terminate_output()))
954 _M_codecvt = _M_codecvt_tmp;
959 // Inhibit implicit instantiations for required instantiations,
960 // which are defined via explicit instantiations elsewhere.
961 // NB: This syntax is a GNU extension.
962 #if _GLIBCXX_EXTERN_TEMPLATE
963 extern template class basic_filebuf<char>;
964 extern template class basic_ifstream<char>;
965 extern template class basic_ofstream<char>;
966 extern template class basic_fstream<char>;
968 #ifdef _GLIBCXX_USE_WCHAR_T
969 extern template class basic_filebuf<wchar_t>;
970 extern template class basic_ifstream<wchar_t>;
971 extern template class basic_ofstream<wchar_t>;
972 extern template class basic_fstream<wchar_t>;
976 _GLIBCXX_END_NAMESPACE