istream.tcc revision 122182
1139823Simp// istream classes -*- C++ -*-
2133920Sandre
3133920Sandre// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
4133920Sandre// Free Software Foundation, Inc.
5133920Sandre//
6133920Sandre// This file is part of the GNU ISO C++ Library.  This library is free
7133920Sandre// software; you can redistribute it and/or modify it under the
8133920Sandre// terms of the GNU General Public License as published by the
9133920Sandre// Free Software Foundation; either version 2, or (at your option)
10133920Sandre// any later version.
11133920Sandre
12133920Sandre// This library is distributed in the hope that it will be useful,
13133920Sandre// but WITHOUT ANY WARRANTY; without even the implied warranty of
14133920Sandre// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15133920Sandre// GNU General Public License for more details.
16133920Sandre
17133920Sandre// You should have received a copy of the GNU General Public License along
18133920Sandre// with this library; see the file COPYING.  If not, write to the Free
19133920Sandre// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20133920Sandre// USA.
21133920Sandre
22133920Sandre// As a special exception, you may use this file as part of a free software
23133920Sandre// library without restriction.  Specifically, if other files instantiate
24133920Sandre// templates or use macros or inline functions from this file, or you compile
25133920Sandre// this file and link it with other files to produce an executable, this
26133920Sandre// file does not by itself cause the resulting executable to be covered by
27172467Ssilby// the GNU General Public License.  This exception does not however
28172467Ssilby// invalidate any other reasons why the executable file might be covered by
29172467Ssilby// the GNU General Public License.
30134346Sru
31133920Sandre//
32133920Sandre// ISO C++ 14882: 27.6.2  Output streams
33133920Sandre//
34133920Sandre
35133920Sandre#pragma GCC system_header
36133920Sandre
37134383Sandre#include <locale>
38152928Sume#include <ostream> // For flush()
39133920Sandre
40133920Sandrenamespace std 
41133920Sandre{
42133920Sandre  template<typename _CharT, typename _Traits>
43133920Sandre    basic_istream<_CharT, _Traits>::sentry::
44133920Sandre    sentry(basic_istream<_CharT, _Traits>& __in, bool __noskipws)
45133920Sandre    {
46185895Szec      if (__in.good()) 
47185895Szec	{
48133920Sandre	  if (__in.tie())
49133920Sandre	    __in.tie()->flush();
50133920Sandre	  if (!__noskipws && (__in.flags() & ios_base::skipws))
51133920Sandre	    {	  
52133920Sandre	      const __int_type __eof = traits_type::eof();
53133920Sandre	      __streambuf_type* __sb = __in.rdbuf();
54196423Sjulian	      __int_type __c = __sb->sgetc();
55133920Sandre
56133920Sandre	      if (__in._M_check_facet(__in._M_fctype))
57133920Sandre		while (!traits_type::eq_int_type(__c, __eof)
58133920Sandre		       && __in._M_fctype->is(ctype_base::space, 
59133920Sandre					     traits_type::to_char_type(__c)))
60133920Sandre		  __c = __sb->snextc();
61200580Sluigi
62201124Sluigi#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
63133920Sandre//195.  Should basic_istream::sentry's constructor ever set eofbit? 
64133920Sandre	      if (traits_type::eq_int_type(__c, __eof))
65133920Sandre		__in.setstate(ios_base::eofbit);
66215701Sdim#endif
67200601Sluigi	    }
68200601Sluigi	}
69158470Smlaier
70215701Sdim      if (__in.good())
71200601Sluigi	_M_ok = true;
72158470Smlaier      else
73133920Sandre	{
74158470Smlaier	  _M_ok = false;
75158470Smlaier	  __in.setstate(ios_base::failbit);
76136714Sandre	}
77201527Sluigi    }
78133920Sandre
79200601Sluigi  template<typename _CharT, typename _Traits>
80204591Sluigi    basic_istream<_CharT, _Traits>& 
81204591Sluigi    basic_istream<_CharT, _Traits>::
82204591Sluigi    operator>>(__istream_type& (*__pf)(__istream_type&))
83200601Sluigi    {
84200601Sluigi      __pf(*this);
85200601Sluigi      return *this;
86200601Sluigi    }
87200601Sluigi
88200601Sluigi  template<typename _CharT, typename _Traits>
89200601Sluigi    basic_istream<_CharT, _Traits>& 
90200601Sluigi    basic_istream<_CharT, _Traits>::
91200601Sluigi    operator>>(__ios_type& (*__pf)(__ios_type&))
92200601Sluigi    {
93204591Sluigi      __pf(*this);
94204591Sluigi      return *this;
95204591Sluigi    }
96200601Sluigi  
97200601Sluigi  template<typename _CharT, typename _Traits>
98201122Sluigi    basic_istream<_CharT, _Traits>& 
99201122Sluigi    basic_istream<_CharT, _Traits>::
100201122Sluigi    operator>>(ios_base& (*__pf)(ios_base&))
101201122Sluigi    {
102201122Sluigi      __pf(*this);
103204591Sluigi      return *this;
104201122Sluigi    }
105135920Smlaier  
106133920Sandre  template<typename _CharT, typename _Traits>
107133920Sandre    basic_istream<_CharT, _Traits>& 
108201527Sluigi    basic_istream<_CharT, _Traits>::
109201122Sluigi    operator>>(bool& __n)
110201122Sluigi    {
111133920Sandre      sentry __cerb(*this, false);
112201527Sluigi      if (__cerb) 
113201740Sluigi	{
114201740Sluigi	  try 
115201527Sluigi	    {
116201122Sluigi	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
117201122Sluigi	      if (_M_check_facet(_M_fnumget))
118133920Sandre		_M_fnumget->get(*this, 0, *this, __err, __n);
119133920Sandre	      this->setstate(__err);
120173399Soleg	    }
121201527Sluigi	  catch(...)
122201527Sluigi	    {
123201527Sluigi	      // 27.6.1.2.1 Common requirements.
124201527Sluigi	      // Turn this on without causing an ios::failure to be thrown.
125201527Sluigi	      this->_M_setstate(ios_base::badbit);
126201527Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
127201527Sluigi		__throw_exception_again;
128201527Sluigi	    }
129201527Sluigi	}
130201527Sluigi      return *this;
131201527Sluigi    }
132201527Sluigi
133133920Sandre  template<typename _CharT, typename _Traits>
134133920Sandre    basic_istream<_CharT, _Traits>& 
135133920Sandre    basic_istream<_CharT, _Traits>::
136201122Sluigi    operator>>(short& __n)
137135920Smlaier    {
138133920Sandre      sentry __cerb(*this, false);
139201527Sluigi      if (__cerb) 
140201527Sluigi	{
141191570Soleg	  try 
142140224Sglebius	    {
143140224Sglebius	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
144133920Sandre	      long __l;
145201122Sluigi	      if (_M_check_facet(_M_fnumget))
146201122Sluigi		_M_fnumget->get(*this, 0, *this, __err, __l);
147140224Sglebius#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
148140224Sglebius	      // 118. basic_istream uses nonexistent num_get member functions.
149201122Sluigi	      if (!(__err & ios_base::failbit)
150206845Sluigi		  && (numeric_limits<short>::min() <= __l 
151206845Sluigi		      && __l <= numeric_limits<short>::max()))
152201122Sluigi		__n = __l;
153201122Sluigi	      else
154201122Sluigi                __err |= ios_base::failbit;
155201527Sluigi#endif
156201527Sluigi	      this->setstate(__err);
157201527Sluigi	    }
158201122Sluigi	  catch(...)
159201122Sluigi	    {
160201122Sluigi	      // 27.6.1.2.1 Common requirements.
161201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
162201122Sluigi	      this->_M_setstate(ios_base::badbit);
163201122Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
164201122Sluigi		__throw_exception_again;
165201122Sluigi	    }
166201122Sluigi	}
167133920Sandre      return *this;
168133920Sandre    }
169201122Sluigi
170201122Sluigi  template<typename _CharT, typename _Traits>
171201122Sluigi    basic_istream<_CharT, _Traits>& 
172201122Sluigi    basic_istream<_CharT, _Traits>::
173201122Sluigi    operator>>(unsigned short& __n)
174133920Sandre    {
175133920Sandre      sentry __cerb(*this, false);
176133920Sandre      if (__cerb) 
177133920Sandre	{
178133920Sandre	  try 
179201527Sluigi	    {
180133920Sandre	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
181201122Sluigi	      if (_M_check_facet(_M_fnumget))
182133920Sandre		_M_fnumget->get(*this, 0, *this, __err, __n);
183140224Sglebius	      this->setstate(__err);
184201122Sluigi	    }
185201122Sluigi	  catch(...)
186140224Sglebius	    {
187140224Sglebius	      // 27.6.1.2.1 Common requirements.
188201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
189193502Sluigi	      this->_M_setstate(ios_base::badbit);
190201122Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
191145246Sbrooks		__throw_exception_again;
192201122Sluigi	    }
193145246Sbrooks	}
194201122Sluigi      return *this;
195201122Sluigi    }
196201122Sluigi
197201122Sluigi  template<typename _CharT, typename _Traits>
198201122Sluigi    basic_istream<_CharT, _Traits>& 
199201122Sluigi    basic_istream<_CharT, _Traits>::
200201122Sluigi    operator>>(int& __n)
201201122Sluigi    {
202201122Sluigi      sentry __cerb(*this, false);
203201122Sluigi      if (__cerb) 
204173399Soleg	{
205173399Soleg	  try 
206140224Sglebius	    {
207140224Sglebius	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
208140224Sglebius	      long __l;
209140224Sglebius	      if (_M_check_facet(_M_fnumget))
210201122Sluigi		_M_fnumget->get(*this, 0, *this, __err, __l);
211201122Sluigi#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
212201122Sluigi	      // 118. basic_istream uses nonexistent num_get member functions.
213201122Sluigi	      if (!(__err & ios_base::failbit)
214201527Sluigi		  && (numeric_limits<int>::min() <= __l 
215201527Sluigi		      && __l <= numeric_limits<int>::max()))
216201527Sluigi		__n = __l;
217201527Sluigi	      else
218201527Sluigi                __err |= ios_base::failbit;
219201122Sluigi#endif
220140224Sglebius	      this->setstate(__err);
221141351Sglebius	    }
222141351Sglebius	  catch(...)
223201732Sluigi	    {
224201122Sluigi	      // 27.6.1.2.1 Common requirements.
225201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
226201122Sluigi	      this->_M_setstate(ios_base::badbit);
227201122Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
228201122Sluigi		__throw_exception_again;
229201122Sluigi	    }
230201122Sluigi	}
231201122Sluigi      return *this;
232141351Sglebius    }
233165648Spiso
234213254Sluigi  template<typename _CharT, typename _Traits>
235213254Sluigi    basic_istream<_CharT, _Traits>& 
236213254Sluigi    basic_istream<_CharT, _Traits>::
237213254Sluigi    operator>>(unsigned int& __n)
238213254Sluigi    {
239201122Sluigi      sentry __cerb(*this, false);
240165648Spiso      if (__cerb) 
241190633Spiso	{
242140224Sglebius	  try 
243140224Sglebius	    {
244140224Sglebius	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
245140224Sglebius	      if (_M_check_facet(_M_fnumget))
246201122Sluigi		_M_fnumget->get(*this, 0, *this, __err, __n);
247201122Sluigi	      this->setstate(__err);
248201527Sluigi	    }
249201122Sluigi	  catch(...)
250201122Sluigi	    {
251201740Sluigi	      // 27.6.1.2.1 Common requirements.
252201527Sluigi	      // Turn this on without causing an ios::failure to be thrown.
253201122Sluigi	      this->_M_setstate(ios_base::badbit);
254133920Sandre	      if ((this->exceptions() & ios_base::badbit) != 0)
255133920Sandre		__throw_exception_again;
256201527Sluigi	    }
257201527Sluigi	}
258201527Sluigi      return *this;
259201527Sluigi    }
260133920Sandre
261133920Sandre  template<typename _CharT, typename _Traits>
262135154Sandre    basic_istream<_CharT, _Traits>& 
263133920Sandre    basic_istream<_CharT, _Traits>::
264133920Sandre    operator>>(long& __n)
265133920Sandre    {
266201122Sluigi      sentry __cerb(*this, false);
267133920Sandre      if (__cerb) 
268201527Sluigi	{
269133920Sandre	  try 
270133920Sandre	    {
271201122Sluigi	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
272201122Sluigi	      if (_M_check_facet(_M_fnumget))
273201122Sluigi		_M_fnumget->get(*this, 0, *this, __err, __n);
274201122Sluigi	      this->setstate(__err);
275201122Sluigi	    }
276201122Sluigi	  catch(...)
277201122Sluigi	    {
278201122Sluigi	      // 27.6.1.2.1 Common requirements.
279201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
280201527Sluigi	      this->_M_setstate(ios_base::badbit);
281201122Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
282133920Sandre		__throw_exception_again;
283133920Sandre	    }
284201122Sluigi	}
285201122Sluigi      return *this;
286201122Sluigi    }
287201122Sluigi
288201122Sluigi  template<typename _CharT, typename _Traits>
289201122Sluigi    basic_istream<_CharT, _Traits>& 
290133920Sandre    basic_istream<_CharT, _Traits>::
291133920Sandre    operator>>(unsigned long& __n)
292201527Sluigi    {
293201122Sluigi      sentry __cerb(*this, false);
294201122Sluigi      if (__cerb) 
295133920Sandre	{
296201527Sluigi	  try 
297201122Sluigi	    {
298201122Sluigi	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
299201527Sluigi	      if (_M_check_facet(_M_fnumget))
300201122Sluigi		_M_fnumget->get(*this, 0, *this, __err, __n);
301133920Sandre	      this->setstate(__err);
302133920Sandre	    }
303133920Sandre	  catch(...)
304133920Sandre	    {
305201122Sluigi	      // 27.6.1.2.1 Common requirements.
306201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
307201122Sluigi	      this->_M_setstate(ios_base::badbit);
308201122Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
309201122Sluigi		__throw_exception_again;
310201122Sluigi	    }
311201122Sluigi	}
312201122Sluigi      return *this;
313201122Sluigi    }
314133920Sandre
315201527Sluigi#ifdef _GLIBCPP_USE_LONG_LONG
316201527Sluigi  template<typename _CharT, typename _Traits>
317201527Sluigi    basic_istream<_CharT, _Traits>& 
318201527Sluigi    basic_istream<_CharT, _Traits>::
319201527Sluigi    operator>>(long long& __n)
320201527Sluigi    {
321201527Sluigi      sentry __cerb(*this, false);
322201527Sluigi      if (__cerb) 
323201527Sluigi	{
324133920Sandre	  try 
325133920Sandre	    {
326201122Sluigi	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
327201527Sluigi	      if (_M_check_facet(_M_fnumget))
328133920Sandre		_M_fnumget->get(*this, 0, *this, __err, __n);
329133920Sandre	      this->setstate(__err);
330201122Sluigi	    }
331201122Sluigi	  catch(...)
332201122Sluigi	    {
333200601Sluigi	      // 27.6.1.2.1 Common requirements.
334201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
335133920Sandre	      this->_M_setstate(ios_base::badbit);
336201122Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
337133920Sandre	      __throw_exception_again;
338201122Sluigi	    }
339201122Sluigi	}
340133920Sandre      return *this;
341133920Sandre    }
342201527Sluigi
343201527Sluigi  template<typename _CharT, typename _Traits>
344133920Sandre    basic_istream<_CharT, _Traits>& 
345133920Sandre    basic_istream<_CharT, _Traits>::
346133920Sandre    operator>>(unsigned long long& __n)
347133920Sandre    {
348196423Sjulian      sentry __cerb(*this, false);
349201122Sluigi      if (__cerb) 
350133920Sandre	{
351200601Sluigi	  try 
352200601Sluigi	    {
353201122Sluigi	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
354201122Sluigi	      if (_M_check_facet(_M_fnumget))
355206845Sluigi		_M_fnumget->get(*this, 0, *this, __err, __n);
356200601Sluigi	      this->setstate(__err);
357200601Sluigi	    }
358200601Sluigi	  catch(...)
359200601Sluigi	    {
360201122Sluigi	      // 27.6.1.2.1 Common requirements.
361201122Sluigi	      // Turn this on without causing an ios::failure to be thrown.
362206845Sluigi	      this->_M_setstate(ios_base::badbit);
363200601Sluigi	      if ((this->exceptions() & ios_base::badbit) != 0)
364200601Sluigi		__throw_exception_again;
365200601Sluigi	    }
366200601Sluigi	}
367200601Sluigi      return *this;
368200601Sluigi    }
369200601Sluigi#endif
370200601Sluigi
371158470Smlaier  template<typename _CharT, typename _Traits>
372158470Smlaier    basic_istream<_CharT, _Traits>& 
373197952Sjulian    basic_istream<_CharT, _Traits>::
374197952Sjulian    operator>>(float& __n)
375158470Smlaier    {
376201122Sluigi      sentry __cerb(*this, false);
377158470Smlaier      if (__cerb) 
378197952Sjulian	{
379197952Sjulian	  try 
380201122Sluigi	    {
381197952Sjulian	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
382197952Sjulian	      if (_M_check_facet(_M_fnumget))
383197952Sjulian		_M_fnumget->get(*this, 0, *this, __err, __n);
384197952Sjulian	      this->setstate(__err);
385201122Sluigi	    }
386197952Sjulian	  catch(...)
387196423Sjulian	    {
388197952Sjulian	      // 27.6.1.2.1 Common requirements.
389197952Sjulian	      // Turn this on without causing an ios::failure to be thrown.
390197952Sjulian	      this->_M_setstate(ios_base::badbit);
391197952Sjulian	      if ((this->exceptions() & ios_base::badbit) != 0)
392197952Sjulian		__throw_exception_again;
393158470Smlaier	    }
394197952Sjulian	}
395158470Smlaier      return *this;
396158470Smlaier    }
397158470Smlaier
398158470Smlaier  template<typename _CharT, typename _Traits>
399158470Smlaier    basic_istream<_CharT, _Traits>& 
400197952Sjulian    basic_istream<_CharT, _Traits>::
401158470Smlaier    operator>>(double& __n)
402158470Smlaier    {
403201122Sluigi      sentry __cerb(*this, false);
404201122Sluigi      if (__cerb) 
405201122Sluigi	{
406201122Sluigi	  try 
407197952Sjulian	    {
408158470Smlaier	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
409201122Sluigi	      if (_M_check_facet(_M_fnumget))
410197952Sjulian		_M_fnumget->get(*this, 0, *this, __err, __n);
411158470Smlaier	      this->setstate(__err);
412158470Smlaier	    }
413158470Smlaier	  catch(...)
414158470Smlaier	    {
415200601Sluigi	      // 27.6.1.2.1 Common requirements.
416	      // Turn this on without causing an ios::failure to be thrown.
417	      this->_M_setstate(ios_base::badbit);
418	      if ((this->exceptions() & ios_base::badbit) != 0)
419		__throw_exception_again;
420	    }
421	}
422      return *this;
423    }
424
425  template<typename _CharT, typename _Traits>
426    basic_istream<_CharT, _Traits>& 
427    basic_istream<_CharT, _Traits>::
428    operator>>(long double& __n)
429    {
430      sentry __cerb(*this, false);
431      if (__cerb) 
432	{
433	  try 
434	    {
435	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
436	      if (_M_check_facet(_M_fnumget))
437		_M_fnumget->get(*this, 0, *this, __err, __n);
438	      this->setstate(__err);
439	    }
440	  catch(...)
441	    {
442	      // 27.6.1.2.1 Common requirements.
443	      // Turn this on without causing an ios::failure to be thrown.
444	      this->_M_setstate(ios_base::badbit);
445	      if ((this->exceptions() & ios_base::badbit) != 0)
446		__throw_exception_again;
447	    }
448	}
449      return *this;
450    }
451
452  template<typename _CharT, typename _Traits>
453    basic_istream<_CharT, _Traits>& 
454    basic_istream<_CharT, _Traits>::
455    operator>>(void*& __n)
456    {
457      sentry __cerb(*this, false);
458      if (__cerb) 
459	{
460	  try 
461	    {
462	      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
463	      if (_M_check_facet(_M_fnumget))
464		_M_fnumget->get(*this, 0, *this, __err, __n);
465	      this->setstate(__err);
466	    }
467	  catch(...)
468	    {
469	      // 27.6.1.2.1 Common requirements.
470	      // Turn this on without causing an ios::failure to be thrown.
471	      this->_M_setstate(ios_base::badbit);
472	      if ((this->exceptions() & ios_base::badbit) != 0)
473		__throw_exception_again;
474	    }
475	}
476      return *this;
477    }
478
479  template<typename _CharT, typename _Traits>
480    basic_istream<_CharT, _Traits>& 
481    basic_istream<_CharT, _Traits>::
482    operator>>(__streambuf_type* __sbout)
483    {
484       sentry __cerb(*this, false);
485       if (__cerb)
486	 {
487	   try
488	     {
489	       streamsize __xtrct = 0;
490	       if (__sbout)
491		 {
492		   __streambuf_type* __sbin = this->rdbuf();
493		   __xtrct = __copy_streambufs(*this, __sbin, __sbout);
494		 }
495	       if (!__sbout || !__xtrct)
496		 this->setstate(ios_base::failbit);
497	     }
498	   catch(...)
499	     {
500	       // 27.6.2.5.1 Common requirements.
501	       // Turn this on without causing an ios::failure to be thrown.
502	       this->_M_setstate(ios_base::badbit);
503	       if ((this->exceptions() & ios_base::badbit) != 0)
504		 __throw_exception_again;
505	     }
506	 }
507       return *this;
508    }
509
510  template<typename _CharT, typename _Traits>
511    typename basic_istream<_CharT, _Traits>::int_type
512    basic_istream<_CharT, _Traits>::
513    get(void)
514    {
515      const int_type __eof = traits_type::eof();
516      int_type __c = __eof;
517      _M_gcount = 0;
518      sentry __cerb(*this, true);
519      if (__cerb) 
520	{
521	  try 
522	    {
523	      __c = this->rdbuf()->sbumpc();
524	      // 27.6.1.1 paragraph 3
525	      if (!traits_type::eq_int_type(__c, __eof))
526		_M_gcount = 1;
527	      else
528		this->setstate(ios_base::eofbit | ios_base::failbit);
529	    }
530	  catch(...)
531	    {
532	      // 27.6.1.3 paragraph 1
533	      // Turn this on without causing an ios::failure to be thrown.
534	      this->_M_setstate(ios_base::badbit);
535	      if ((this->exceptions() & ios_base::badbit) != 0)
536		__throw_exception_again;
537	    }
538	}
539      return __c;
540    }
541
542  template<typename _CharT, typename _Traits>
543    basic_istream<_CharT, _Traits>&
544    basic_istream<_CharT, _Traits>::
545    get(char_type& __c)
546    {
547      _M_gcount = 0;
548      sentry __cerb(*this, true);
549      if (__cerb) 
550	{
551 	  try 
552	    {
553	      const int_type __eof = traits_type::eof();
554	      int_type __bufval = this->rdbuf()->sbumpc();
555	      // 27.6.1.1 paragraph 3
556	      if (!traits_type::eq_int_type(__bufval, __eof))
557		{
558		  _M_gcount = 1;
559		  __c = traits_type::to_char_type(__bufval);
560		}
561	      else
562		this->setstate(ios_base::eofbit | ios_base::failbit);
563	    }
564	  catch(...)
565	    {
566	      // 27.6.1.3 paragraph 1
567	      // Turn this on without causing an ios::failure to be thrown.
568	      this->_M_setstate(ios_base::badbit);
569	      if ((this->exceptions() & ios_base::badbit) != 0)
570		__throw_exception_again;
571	    }
572	}
573      return *this;
574    }
575
576  template<typename _CharT, typename _Traits>
577    basic_istream<_CharT, _Traits>&
578    basic_istream<_CharT, _Traits>::
579    get(char_type* __s, streamsize __n, char_type __delim)
580    {
581      _M_gcount = 0;
582      sentry __cerb(*this, true);
583      if (__cerb) 
584	{
585	  try 
586	    {
587	      const int_type __idelim = traits_type::to_int_type(__delim);
588	      const int_type __eof = traits_type::eof();
589	      __streambuf_type* __sb = this->rdbuf();
590	      int_type __c = __sb->sgetc();	
591	      
592	      while (_M_gcount + 1 < __n 
593		     && !traits_type::eq_int_type(__c, __eof)
594		     && !traits_type::eq_int_type(__c, __idelim))
595		{
596		  *__s++ = traits_type::to_char_type(__c);
597		  __c = __sb->snextc();
598		  ++_M_gcount;
599		}
600	      if (traits_type::eq_int_type(__c, __eof))
601		this->setstate(ios_base::eofbit);
602	    }
603	  catch(...)
604	    {
605	      // 27.6.1.3 paragraph 1
606	      // Turn this on without causing an ios::failure to be thrown.
607	      this->_M_setstate(ios_base::badbit);
608	      if ((this->exceptions() & ios_base::badbit) != 0)
609		__throw_exception_again;
610	    }
611	}
612      *__s = char_type();
613      if (!_M_gcount)
614	this->setstate(ios_base::failbit);
615      return *this;
616    }
617
618  template<typename _CharT, typename _Traits>
619    basic_istream<_CharT, _Traits>&
620    basic_istream<_CharT, _Traits>::
621    get(__streambuf_type& __sb, char_type __delim)
622    {
623      _M_gcount = 0;
624      sentry __cerb(*this, true);
625      if (__cerb) 
626	{
627	  try 
628	    {
629	      const int_type __idelim = traits_type::to_int_type(__delim);
630	      const int_type __eof = traits_type::eof();	      
631	      __streambuf_type* __this_sb = this->rdbuf();
632	      int_type __c = __this_sb->sgetc();
633	      char_type __c2 = traits_type::to_char_type(__c);
634	      
635	      while (!traits_type::eq_int_type(__c, __eof) 
636		     && !traits_type::eq_int_type(__c, __idelim) 
637		     && !traits_type::eq_int_type(__sb.sputc(__c2), __eof))
638		{
639		  ++_M_gcount;
640		  __c = __this_sb->snextc();
641		  __c2 = traits_type::to_char_type(__c);
642		}
643	      if (traits_type::eq_int_type(__c, __eof))
644		this->setstate(ios_base::eofbit);
645	    }
646	  catch(...)
647	    {
648	      // 27.6.1.3 paragraph 1
649	      // Turn this on without causing an ios::failure to be thrown.
650	      this->_M_setstate(ios_base::badbit);
651	      if ((this->exceptions() & ios_base::badbit) != 0)
652		__throw_exception_again;
653	    }
654	}
655      if (!_M_gcount)
656	this->setstate(ios_base::failbit);
657      return *this;
658    }
659
660  template<typename _CharT, typename _Traits>
661    basic_istream<_CharT, _Traits>&
662    basic_istream<_CharT, _Traits>::
663    getline(char_type* __s, streamsize __n, char_type __delim)
664    {
665      _M_gcount = 0;
666      sentry __cerb(*this, true);
667      if (__cerb) 
668	{
669          try 
670	    {
671	      const int_type __idelim = traits_type::to_int_type(__delim);
672	      const int_type __eof = traits_type::eof();
673	      __streambuf_type* __sb = this->rdbuf();
674	      int_type __c = __sb->sgetc();
675	    
676	      while (_M_gcount + 1 < __n 
677		     && !traits_type::eq_int_type(__c, __eof)
678		     && !traits_type::eq_int_type(__c, __idelim))
679		{
680		  *__s++ = traits_type::to_char_type(__c);
681		  __c = __sb->snextc();
682		  ++_M_gcount;
683		}
684	      if (traits_type::eq_int_type(__c, __eof))
685		this->setstate(ios_base::eofbit);
686	      else
687		{
688		  if (traits_type::eq_int_type(__c, __idelim))
689		    {
690		      __sb->sbumpc();
691		      ++_M_gcount;
692		    }
693		  else
694		    this->setstate(ios_base::failbit);
695		}
696	    }
697	  catch(...)
698	    {
699	      // 27.6.1.3 paragraph 1
700	      // Turn this on without causing an ios::failure to be thrown.
701	      this->_M_setstate(ios_base::badbit);
702	      if ((this->exceptions() & ios_base::badbit) != 0)
703		__throw_exception_again;
704	    }
705	}
706      *__s = char_type();
707      if (!_M_gcount)
708	this->setstate(ios_base::failbit);
709      return *this;
710    }
711  
712  template<typename _CharT, typename _Traits>
713    basic_istream<_CharT, _Traits>&
714    basic_istream<_CharT, _Traits>::
715    ignore(streamsize __n, int_type __delim)
716    {
717      _M_gcount = 0;
718      sentry __cerb(*this, true);
719      if (__cerb && __n > 0) 
720	{
721	  try 
722	    {
723	      const int_type __eof = traits_type::eof();
724	      __streambuf_type* __sb = this->rdbuf();
725	      int_type __c;
726	      
727	      __n = min(__n, numeric_limits<streamsize>::max());
728	      while (_M_gcount < __n  
729		     && !traits_type::eq_int_type(__c = __sb->sbumpc(), __eof))
730		{
731		  ++_M_gcount;
732		  if (traits_type::eq_int_type(__c, __delim))
733		    break;
734		}
735	      if (traits_type::eq_int_type(__c, __eof))
736		this->setstate(ios_base::eofbit);
737	    }
738	  catch(...)
739	    {
740	      // 27.6.1.3 paragraph 1
741	      // Turn this on without causing an ios::failure to be thrown.
742	      this->_M_setstate(ios_base::badbit);
743	      if ((this->exceptions() & ios_base::badbit) != 0)
744		__throw_exception_again;
745	    }
746	}
747      return *this;
748    }
749  
750  template<typename _CharT, typename _Traits>
751    typename basic_istream<_CharT, _Traits>::int_type
752    basic_istream<_CharT, _Traits>::
753    peek(void)
754    {
755      int_type __c = traits_type::eof();
756      _M_gcount = 0;
757      sentry __cerb(*this, true);
758      if (__cerb)
759	{
760	  try
761	    {
762	      __c = this->rdbuf()->sgetc();
763	      if (traits_type::eq_int_type(__c, traits_type::eof()))
764		this->setstate(ios_base::eofbit);
765	    }
766	  catch(...)
767	    {
768	      // 27.6.1.3 paragraph 1
769	      // Turn this on without causing an ios::failure to be thrown.
770	      this->_M_setstate(ios_base::badbit);
771	      if ((this->exceptions() & ios_base::badbit) != 0)
772		__throw_exception_again;
773	    }
774	} 
775      return __c;
776    }
777
778  template<typename _CharT, typename _Traits>
779    basic_istream<_CharT, _Traits>&
780    basic_istream<_CharT, _Traits>::
781    read(char_type* __s, streamsize __n)
782    {
783      _M_gcount = 0;
784      sentry __cerb(*this, true);
785      if (__cerb) 
786	{
787	  try 
788	    {
789	      _M_gcount = this->rdbuf()->sgetn(__s, __n);
790	      if (_M_gcount != __n)
791		this->setstate(ios_base::eofbit | ios_base::failbit);
792	    }	    
793	  catch(...)
794	    {
795	      // 27.6.1.3 paragraph 1
796	      // Turn this on without causing an ios::failure to be thrown.
797	      this->_M_setstate(ios_base::badbit);
798	      if ((this->exceptions() & ios_base::badbit) != 0)
799		__throw_exception_again;
800	    }
801	}
802      else
803	this->setstate(ios_base::failbit);
804      return *this;
805    }
806  
807  template<typename _CharT, typename _Traits>
808    streamsize 
809    basic_istream<_CharT, _Traits>::
810    readsome(char_type* __s, streamsize __n)
811    {
812      _M_gcount = 0;
813      sentry __cerb(*this, true);
814      if (__cerb) 
815	{
816	  try 
817	    {
818	      // Cannot compare int_type with streamsize generically.
819	      streamsize __num = this->rdbuf()->in_avail();
820	      if (__num >= 0)
821		{
822		  __num = min(__num, __n);
823		  if (__num)
824		    _M_gcount = this->rdbuf()->sgetn(__s, __num);
825		}
826	      else
827		this->setstate(ios_base::eofbit);		    
828	    }
829	  catch(...)
830	    {
831	      // 27.6.1.3 paragraph 1
832	      // Turn this on without causing an ios::failure to be thrown.
833	      this->_M_setstate(ios_base::badbit);
834	      if ((this->exceptions() & ios_base::badbit) != 0)
835		__throw_exception_again;
836	    }
837	}
838      else
839	this->setstate(ios_base::failbit);
840      return _M_gcount;
841    }
842      
843  template<typename _CharT, typename _Traits>
844    basic_istream<_CharT, _Traits>&
845    basic_istream<_CharT, _Traits>::
846    putback(char_type __c)
847    {
848#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
849// 60. What is a formatted input function?
850      _M_gcount = 0;
851#endif
852      sentry __cerb(*this, true);
853      if (__cerb) 
854	{
855	  try 
856	    {
857	      const int_type __eof = traits_type::eof();
858	      __streambuf_type* __sb = this->rdbuf();
859	      if (!__sb 
860		  || traits_type::eq_int_type(__sb->sputbackc(__c), __eof))
861		this->setstate(ios_base::badbit);		    
862	    }
863	  catch(...)
864	    {
865	      // 27.6.1.3 paragraph 1
866	      // Turn this on without causing an ios::failure to be thrown.
867	      this->_M_setstate(ios_base::badbit);
868	      if ((this->exceptions() & ios_base::badbit) != 0)
869		__throw_exception_again;
870	    }
871	}
872      else
873	this->setstate(ios_base::failbit);
874      return *this;
875    }
876  
877  template<typename _CharT, typename _Traits>
878    basic_istream<_CharT, _Traits>&
879    basic_istream<_CharT, _Traits>::
880    unget(void)
881    {
882#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
883// 60. What is a formatted input function?
884      _M_gcount = 0;
885#endif
886      sentry __cerb(*this, true);
887      if (__cerb) 
888	{
889	  try 
890	    {
891	      const int_type __eof = traits_type::eof();
892	      __streambuf_type* __sb = this->rdbuf();
893	      if (!__sb 
894		  || traits_type::eq_int_type(__sb->sungetc(), __eof))
895		this->setstate(ios_base::badbit);		    
896	    }
897	  catch(...)
898	    {
899	      // 27.6.1.3 paragraph 1
900	      // Turn this on without causing an ios::failure to be thrown.
901	      this->_M_setstate(ios_base::badbit);
902	      if ((this->exceptions() & ios_base::badbit) != 0)
903		__throw_exception_again;
904	    }
905	}
906      else
907	this->setstate(ios_base::failbit);
908      return *this;
909    }
910  
911  template<typename _CharT, typename _Traits>
912    int
913    basic_istream<_CharT, _Traits>::
914    sync(void)
915    {
916      // DR60.  Do not change _M_gcount.
917      int __ret = -1;
918      sentry __cerb(*this, true);
919      if (__cerb) 
920	{
921	  try 
922	    {
923	      __streambuf_type* __sb = this->rdbuf();
924	      if (__sb)
925		{
926		  if (__sb->pubsync() == -1)
927		    this->setstate(ios_base::badbit);		    
928		  else 
929		    __ret = 0;
930		}
931	    }
932	  catch(...)
933	    {
934	      // 27.6.1.3 paragraph 1
935	      // Turn this on without causing an ios::failure to be thrown.
936	      this->_M_setstate(ios_base::badbit);
937	      if ((this->exceptions() & ios_base::badbit) != 0)
938		__throw_exception_again;
939	    }
940	}
941      return __ret;
942    }
943  
944  template<typename _CharT, typename _Traits>
945    typename basic_istream<_CharT, _Traits>::pos_type
946    basic_istream<_CharT, _Traits>::
947    tellg(void)
948    {
949      // DR60.  Do not change _M_gcount.
950      pos_type __ret = pos_type(-1);
951      if (!this->fail())
952	__ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
953      return __ret;
954    }
955
956
957  template<typename _CharT, typename _Traits>
958    basic_istream<_CharT, _Traits>&
959    basic_istream<_CharT, _Traits>::
960    seekg(pos_type __pos)
961    {
962      // DR60.  Do not change _M_gcount.
963      if (!this->fail())
964	{
965#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
966// 136.  seekp, seekg setting wrong streams?
967	  pos_type __err = this->rdbuf()->pubseekpos(__pos, ios_base::in);
968
969// 129. Need error indication from seekp() and seekg()
970	  if (__err == pos_type(off_type(-1)))
971	    this->setstate(ios_base::failbit);
972#endif
973	}
974      return *this;
975    }
976
977  template<typename _CharT, typename _Traits>
978    basic_istream<_CharT, _Traits>&
979    basic_istream<_CharT, _Traits>::
980    seekg(off_type __off, ios_base::seekdir __dir)
981    {
982      // DR60.  Do not change _M_gcount.
983      if (!this->fail())
984	{
985#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
986// 136.  seekp, seekg setting wrong streams?
987	  pos_type __err = this->rdbuf()->pubseekoff(__off, __dir, 
988						     ios_base::in);
989
990// 129. Need error indication from seekp() and seekg()
991	  if (__err == pos_type(off_type(-1)))
992	    this->setstate(ios_base::failbit);
993#endif
994	}
995      return *this;
996    }
997
998  // 27.6.1.2.3 Character extraction templates
999  template<typename _CharT, typename _Traits>
1000    basic_istream<_CharT, _Traits>&
1001    operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
1002    {
1003      typedef basic_istream<_CharT, _Traits> 		__istream_type;
1004      typename __istream_type::sentry __cerb(__in, false);
1005      if (__cerb)
1006	{
1007	  try 
1008	    { __in.get(__c); }
1009	  catch(...)
1010	    {
1011	      // 27.6.1.2.1 Common requirements.
1012	      // Turn this on without causing an ios::failure to be thrown.
1013	      __in._M_setstate(ios_base::badbit);
1014	      if ((__in.exceptions() & ios_base::badbit) != 0)
1015		__throw_exception_again;
1016	    }
1017	}
1018      else
1019	__in.setstate(ios_base::failbit);
1020      return __in;
1021    }
1022
1023  template<typename _CharT, typename _Traits>
1024    basic_istream<_CharT, _Traits>&
1025    operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
1026    {
1027      typedef basic_istream<_CharT, _Traits> 		__istream_type;
1028      typedef typename __istream_type::__streambuf_type __streambuf_type;
1029      typedef typename _Traits::int_type 		int_type;
1030      typedef _CharT                     		char_type;
1031      typedef ctype<_CharT>     			__ctype_type;
1032      streamsize __extracted = 0;
1033
1034      typename __istream_type::sentry __cerb(__in, false);
1035      if (__cerb)
1036	{
1037	  try 
1038	    {
1039	      // Figure out how many characters to extract.
1040	      streamsize __num = __in.width();
1041	      if (__num <= 0)
1042		__num = numeric_limits<streamsize>::max();
1043	      
1044	      const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
1045	      const int_type __eof = _Traits::eof();
1046	      __streambuf_type* __sb = __in.rdbuf();
1047	      int_type __c = __sb->sgetc();
1048	      
1049	      while (__extracted < __num - 1 
1050		     && !_Traits::eq_int_type(__c, __eof)
1051		     && !__ctype.is(ctype_base::space, _Traits::to_char_type(__c)))
1052		{
1053		  *__s++ = _Traits::to_char_type(__c);
1054		  ++__extracted;
1055		  __c = __sb->snextc();
1056		}
1057	      if (_Traits::eq_int_type(__c, __eof))
1058		__in.setstate(ios_base::eofbit);
1059
1060#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
1061//68.  Extractors for char* should store null at end
1062	      *__s = char_type();
1063#endif
1064	      __in.width(0);
1065	    }
1066	  catch(...)
1067	    {
1068	      // 27.6.1.2.1 Common requirements.
1069	      // Turn this on without causing an ios::failure to be thrown.
1070	      __in._M_setstate(ios_base::badbit);
1071	      if ((__in.exceptions() & ios_base::badbit) != 0)
1072		__throw_exception_again;
1073	    }
1074	}
1075      if (!__extracted)
1076	__in.setstate(ios_base::failbit);
1077      return __in;
1078    }
1079
1080  // 27.6.1.4 Standard basic_istream manipulators
1081  template<typename _CharT, typename _Traits>
1082    basic_istream<_CharT,_Traits>& 
1083    ws(basic_istream<_CharT,_Traits>& __in)
1084    {
1085      typedef basic_istream<_CharT, _Traits> 		__istream_type;
1086      typedef typename __istream_type::__streambuf_type __streambuf_type;
1087      typedef typename __istream_type::__ctype_type 	__ctype_type;
1088      typedef typename __istream_type::int_type 	__int_type;
1089
1090      const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
1091      const __int_type __eof = _Traits::eof();	      
1092      __streambuf_type* __sb = __in.rdbuf();
1093      __int_type __c = __sb->sgetc();
1094
1095      while (!_Traits::eq_int_type(__c, __eof) 
1096	     && __ctype.is(ctype_base::space, _Traits::to_char_type(__c)))
1097	__c = __sb->snextc();
1098
1099       if (_Traits::eq_int_type(__c, __eof))
1100	__in.setstate(ios_base::eofbit);
1101
1102      return __in;
1103    }
1104
1105  // 21.3.7.9 basic_string::getline and operators
1106  template<typename _CharT, typename _Traits, typename _Alloc>
1107    basic_istream<_CharT, _Traits>&
1108    operator>>(basic_istream<_CharT, _Traits>& __in,
1109	       basic_string<_CharT, _Traits, _Alloc>& __str)
1110    {
1111      typedef basic_istream<_CharT, _Traits> 		__istream_type;
1112      typedef typename __istream_type::int_type 	__int_type;
1113      typedef typename __istream_type::__streambuf_type __streambuf_type;
1114      typedef typename __istream_type::__ctype_type 	__ctype_type;
1115      typedef basic_string<_CharT, _Traits, _Alloc> 	__string_type;
1116      typedef typename __string_type::size_type		__size_type;
1117      __size_type __extracted = 0;
1118
1119      typename __istream_type::sentry __cerb(__in, false);
1120      if (__cerb) 
1121	{
1122	  __str.erase();
1123	  streamsize __w = __in.width();
1124	  __size_type __n;
1125	  __n = __w > 0 ? static_cast<__size_type>(__w) : __str.max_size();
1126
1127	  const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
1128	  const __int_type __eof = _Traits::eof();
1129	  __streambuf_type* __sb = __in.rdbuf();
1130	  __int_type __c = __sb->sgetc();
1131	  
1132	  while (__extracted < __n 
1133		 && !_Traits::eq_int_type(__c, __eof)
1134		 && !__ctype.is(ctype_base::space, _Traits::to_char_type(__c)))
1135	    {
1136	      __str += _Traits::to_char_type(__c);
1137	      ++__extracted;
1138	      __c = __sb->snextc();
1139	    }
1140	  if (_Traits::eq_int_type(__c, __eof))
1141	    __in.setstate(ios_base::eofbit);
1142	  __in.width(0);
1143	}
1144#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
1145//211.  operator>>(istream&, string&) doesn't set failbit
1146      if (!__extracted)
1147	__in.setstate (ios_base::failbit);
1148#endif
1149      return __in;
1150    }
1151
1152  template<typename _CharT, typename _Traits, typename _Alloc>
1153    basic_istream<_CharT, _Traits>&
1154    getline(basic_istream<_CharT, _Traits>& __in,
1155	    basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)
1156    {
1157      typedef basic_istream<_CharT, _Traits> 		__istream_type;
1158      typedef typename __istream_type::int_type 	__int_type;
1159      typedef typename __istream_type::__streambuf_type __streambuf_type;
1160      typedef typename __istream_type::__ctype_type 	__ctype_type;
1161      typedef basic_string<_CharT, _Traits, _Alloc> 	__string_type;
1162      typedef typename __string_type::size_type		__size_type;
1163
1164      __size_type __extracted = 0;
1165      bool __testdelim = false;
1166      typename __istream_type::sentry __cerb(__in, true);
1167      if (__cerb) 
1168	{
1169	  __str.erase();
1170	  __size_type __n = __str.max_size();
1171
1172	  __int_type __idelim = _Traits::to_int_type(__delim);
1173	  __streambuf_type* __sb = __in.rdbuf();
1174	  __int_type __c = __sb->sbumpc();
1175	  const __int_type __eof = _Traits::eof();
1176	  __testdelim = _Traits::eq_int_type(__c, __idelim);
1177
1178	  while (__extracted <= __n 
1179		 && !_Traits::eq_int_type(__c, __eof)
1180		 && !__testdelim)
1181	    {
1182	      __str += _Traits::to_char_type(__c);
1183	      ++__extracted;
1184	      __c = __sb->sbumpc();
1185	      __testdelim = _Traits::eq_int_type(__c, __idelim);
1186	    }
1187	  if (_Traits::eq_int_type(__c, __eof))
1188	    __in.setstate(ios_base::eofbit);
1189	}
1190      if (!__extracted && !__testdelim)
1191	__in.setstate(ios_base::failbit);
1192      return __in;
1193    }
1194
1195  template<class _CharT, class _Traits, class _Alloc>
1196    inline basic_istream<_CharT,_Traits>&
1197    getline(basic_istream<_CharT, _Traits>& __in, 
1198	    basic_string<_CharT,_Traits,_Alloc>& __str)
1199    { return getline(__in, __str, __in.widen('\n')); }
1200
1201  // Inhibit implicit instantiations for required instantiations,
1202  // which are defined via explicit instantiations elsewhere.  
1203  // NB:  This syntax is a GNU extension.
1204#if _GLIBCPP_EXTERN_TEMPLATE
1205  extern template class basic_istream<char>;
1206  extern template istream& ws(istream&);
1207  extern template istream& operator>>(istream&, char&);
1208  extern template istream& operator>>(istream&, char*);
1209  extern template istream& operator>>(istream&, unsigned char&);
1210  extern template istream& operator>>(istream&, signed char&);
1211  extern template istream& operator>>(istream&, unsigned char*);
1212  extern template istream& operator>>(istream&, signed char*);
1213
1214#ifdef _GLIBCPP_USE_WCHAR_T
1215  extern template class basic_istream<wchar_t>;
1216  extern template wistream& ws(wistream&);
1217  extern template wistream& operator>>(wistream&, wchar_t&);
1218  extern template wistream& operator>>(wistream&, wchar_t*);
1219#endif
1220#endif
1221} // namespace std
1222