2 //===--------------------------- istream ----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_ISTREAM
12 #define _LIBCPP_ISTREAM
17 template <class charT, class traits = char_traits<charT> >
19 : virtual public basic_ios<charT,traits>
22 // types (inherited from basic_ios (27.5.4)):
23 typedef charT char_type;
24 typedef traits traits_type;
25 typedef typename traits_type::int_type int_type;
26 typedef typename traits_type::pos_type pos_type;
27 typedef typename traits_type::off_type off_type;
29 // 27.7.1.1.1 Constructor/destructor:
30 explicit basic_istream(basic_streambuf<char_type, traits_type>* sb);
31 basic_istream(basic_istream&& rhs);
32 virtual ~basic_istream();
34 // 27.7.1.1.2 Assign/swap:
35 basic_istream& operator=(basic_istream&& rhs);
36 void swap(basic_istream& rhs);
38 // 27.7.1.1.3 Prefix/suffix:
41 // 27.7.1.2 Formatted input:
42 basic_istream& operator>>(basic_istream& (*pf)(basic_istream&));
43 basic_istream& operator>>(basic_ios<char_type, traits_type>&
44 (*pf)(basic_ios<char_type, traits_type>&));
45 basic_istream& operator>>(ios_base& (*pf)(ios_base&));
46 basic_istream& operator>>(basic_streambuf<char_type, traits_type>* sb);
47 basic_istream& operator>>(bool& n);
48 basic_istream& operator>>(short& n);
49 basic_istream& operator>>(unsigned short& n);
50 basic_istream& operator>>(int& n);
51 basic_istream& operator>>(unsigned int& n);
52 basic_istream& operator>>(long& n);
53 basic_istream& operator>>(unsigned long& n);
54 basic_istream& operator>>(long long& n);
55 basic_istream& operator>>(unsigned long long& n);
56 basic_istream& operator>>(float& f);
57 basic_istream& operator>>(double& f);
58 basic_istream& operator>>(long double& f);
59 basic_istream& operator>>(void*& p);
61 // 27.7.1.3 Unformatted input:
62 streamsize gcount() const;
64 basic_istream& get(char_type& c);
65 basic_istream& get(char_type* s, streamsize n);
66 basic_istream& get(char_type* s, streamsize n, char_type delim);
67 basic_istream& get(basic_streambuf<char_type,traits_type>& sb);
68 basic_istream& get(basic_streambuf<char_type,traits_type>& sb, char_type delim);
70 basic_istream& getline(char_type* s, streamsize n);
71 basic_istream& getline(char_type* s, streamsize n, char_type delim);
73 basic_istream& ignore(streamsize n = 1, int_type delim = traits_type::eof());
75 basic_istream& read (char_type* s, streamsize n);
76 streamsize readsome(char_type* s, streamsize n);
78 basic_istream& putback(char_type c);
79 basic_istream& unget();
83 basic_istream& seekg(pos_type);
84 basic_istream& seekg(off_type, ios_base::seekdir);
87 // 27.7.1.2.3 character extraction templates:
88 template<class charT, class traits>
89 basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT&);
91 template<class traits>
92 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char&);
94 template<class traits>
95 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char&);
97 template<class charT, class traits>
98 basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT*);
100 template<class traits>
101 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char*);
103 template<class traits>
104 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char*);
106 template <class charT, class traits>
108 swap(basic_istream<charT, traits>& x, basic_istream<charT, traits>& y);
110 typedef basic_istream<char> istream;
111 typedef basic_istream<wchar_t> wistream;
113 template <class charT, class traits = char_traits<charT> >
114 class basic_iostream :
115 public basic_istream<charT,traits>,
116 public basic_ostream<charT,traits>
120 typedef charT char_type;
121 typedef traits traits_type;
122 typedef typename traits_type::int_type int_type;
123 typedef typename traits_type::pos_type pos_type;
124 typedef typename traits_type::off_type off_type;
126 // constructor/destructor
127 explicit basic_iostream(basic_streambuf<char_type, traits_type>* sb);
128 basic_iostream(basic_iostream&& rhs);
129 virtual ~basic_iostream();
132 basic_iostream& operator=(basic_iostream&& rhs);
133 void swap(basic_iostream& rhs);
136 template <class charT, class traits>
138 swap(basic_iostream<charT, traits>& x, basic_iostream<charT, traits>& y);
140 typedef basic_iostream<char> iostream;
141 typedef basic_iostream<wchar_t> wiostream;
143 template <class charT, class traits>
144 basic_istream<charT,traits>&
145 ws(basic_istream<charT,traits>& is);
147 template <class charT, class traits, class T>
148 basic_istream<charT, traits>&
149 operator>>(basic_istream<charT, traits>&& is, T& x);
158 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
159 #pragma GCC system_header
162 _LIBCPP_BEGIN_NAMESPACE_STD
164 template <class _CharT, class _Traits>
165 class _LIBCPP_VISIBLE basic_istream
166 : virtual public basic_ios<_CharT, _Traits>
170 // types (inherited from basic_ios (27.5.4)):
171 typedef _CharT char_type;
172 typedef _Traits traits_type;
173 typedef typename traits_type::int_type int_type;
174 typedef typename traits_type::pos_type pos_type;
175 typedef typename traits_type::off_type off_type;
177 // 27.7.1.1.1 Constructor/destructor:
178 explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb);
179 virtual ~basic_istream();
181 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
182 _LIBCPP_INLINE_VISIBILITY
183 basic_istream(basic_istream&& __rhs);
186 // 27.7.1.1.2 Assign/swap:
187 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
188 _LIBCPP_INLINE_VISIBILITY
189 basic_istream& operator=(basic_istream&& __rhs);
191 void swap(basic_istream& __rhs);
194 // 27.7.1.1.3 Prefix/suffix:
197 // 27.7.1.2 Formatted input:
198 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
199 basic_istream& operator>>(basic_ios<char_type, traits_type>&
200 (*__pf)(basic_ios<char_type, traits_type>&));
201 basic_istream& operator>>(ios_base& (*__pf)(ios_base&));
202 basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
203 basic_istream& operator>>(bool& __n);
204 basic_istream& operator>>(short& __n);
205 basic_istream& operator>>(unsigned short& __n);
206 basic_istream& operator>>(int& __n);
207 basic_istream& operator>>(unsigned int& __n);
208 basic_istream& operator>>(long& __n);
209 basic_istream& operator>>(unsigned long& __n);
210 basic_istream& operator>>(long long& __n);
211 basic_istream& operator>>(unsigned long long& __n);
212 basic_istream& operator>>(float& __f);
213 basic_istream& operator>>(double& __f);
214 basic_istream& operator>>(long double& __f);
215 basic_istream& operator>>(void*& __p);
217 // 27.7.1.3 Unformatted input:
218 _LIBCPP_INLINE_VISIBILITY
219 streamsize gcount() const {return __gc_;}
221 basic_istream& get(char_type& __c);
222 basic_istream& get(char_type* __s, streamsize __n);
223 basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
224 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb);
225 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
227 basic_istream& getline(char_type* __s, streamsize __n);
228 basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
230 basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
232 basic_istream& read (char_type* __s, streamsize __n);
233 streamsize readsome(char_type* __s, streamsize __n);
235 basic_istream& putback(char_type __c);
236 basic_istream& unget();
240 basic_istream& seekg(pos_type __pos);
241 basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
244 template <class _CharT, class _Traits>
245 class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
249 sentry(const sentry&); // = delete;
250 sentry& operator=(const sentry&); // = delete;
253 explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
254 // ~sentry() = default;
256 _LIBCPP_INLINE_VISIBILITY
258 operator bool() const {return __ok_;}
261 template <class _CharT, class _Traits>
262 basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is,
270 if (!__noskipws && (__is.flags() & ios_base::skipws))
272 typedef istreambuf_iterator<_CharT, _Traits> _I;
273 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
276 for (; __i != __eof; ++__i)
277 if (!__ct.is(__ct.space, *__i))
280 __is.setstate(ios_base::failbit | ios_base::eofbit);
285 __is.setstate(ios_base::failbit);
288 template <class _CharT, class _Traits>
289 inline _LIBCPP_INLINE_VISIBILITY
290 basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_type>* __sb)
296 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
298 template <class _CharT, class _Traits>
299 inline _LIBCPP_INLINE_VISIBILITY
300 basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
307 template <class _CharT, class _Traits>
308 inline _LIBCPP_INLINE_VISIBILITY
309 basic_istream<_CharT, _Traits>&
310 basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
316 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
318 template <class _CharT, class _Traits>
319 basic_istream<_CharT, _Traits>::~basic_istream()
323 template <class _CharT, class _Traits>
324 inline _LIBCPP_INLINE_VISIBILITY
326 basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
328 _VSTD::swap(__gc_, __rhs.__gc_);
329 basic_ios<char_type, traits_type>::swap(__rhs);
332 template <class _CharT, class _Traits>
333 basic_istream<_CharT, _Traits>&
334 basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
336 #ifndef _LIBCPP_NO_EXCEPTIONS
339 #endif // _LIBCPP_NO_EXCEPTIONS
343 typedef istreambuf_iterator<char_type, traits_type> _I;
344 typedef num_get<char_type, _I> _F;
345 ios_base::iostate __err = ios_base::goodbit;
346 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
347 this->setstate(__err);
349 #ifndef _LIBCPP_NO_EXCEPTIONS
353 this->__set_badbit_and_consider_rethrow();
355 #endif // _LIBCPP_NO_EXCEPTIONS
359 template <class _CharT, class _Traits>
360 basic_istream<_CharT, _Traits>&
361 basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
363 #ifndef _LIBCPP_NO_EXCEPTIONS
366 #endif // _LIBCPP_NO_EXCEPTIONS
370 typedef istreambuf_iterator<char_type, traits_type> _I;
371 typedef num_get<char_type, _I> _F;
372 ios_base::iostate __err = ios_base::goodbit;
373 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
374 this->setstate(__err);
376 #ifndef _LIBCPP_NO_EXCEPTIONS
380 this->__set_badbit_and_consider_rethrow();
382 #endif // _LIBCPP_NO_EXCEPTIONS
386 template <class _CharT, class _Traits>
387 basic_istream<_CharT, _Traits>&
388 basic_istream<_CharT, _Traits>::operator>>(long& __n)
390 #ifndef _LIBCPP_NO_EXCEPTIONS
393 #endif // _LIBCPP_NO_EXCEPTIONS
397 typedef istreambuf_iterator<char_type, traits_type> _I;
398 typedef num_get<char_type, _I> _F;
399 ios_base::iostate __err = ios_base::goodbit;
400 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
401 this->setstate(__err);
403 #ifndef _LIBCPP_NO_EXCEPTIONS
407 this->__set_badbit_and_consider_rethrow();
409 #endif // _LIBCPP_NO_EXCEPTIONS
413 template <class _CharT, class _Traits>
414 basic_istream<_CharT, _Traits>&
415 basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
417 #ifndef _LIBCPP_NO_EXCEPTIONS
420 #endif // _LIBCPP_NO_EXCEPTIONS
424 typedef istreambuf_iterator<char_type, traits_type> _I;
425 typedef num_get<char_type, _I> _F;
426 ios_base::iostate __err = ios_base::goodbit;
427 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
428 this->setstate(__err);
430 #ifndef _LIBCPP_NO_EXCEPTIONS
434 this->__set_badbit_and_consider_rethrow();
436 #endif // _LIBCPP_NO_EXCEPTIONS
440 template <class _CharT, class _Traits>
441 basic_istream<_CharT, _Traits>&
442 basic_istream<_CharT, _Traits>::operator>>(long long& __n)
444 #ifndef _LIBCPP_NO_EXCEPTIONS
447 #endif // _LIBCPP_NO_EXCEPTIONS
451 typedef istreambuf_iterator<char_type, traits_type> _I;
452 typedef num_get<char_type, _I> _F;
453 ios_base::iostate __err = ios_base::goodbit;
454 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
455 this->setstate(__err);
457 #ifndef _LIBCPP_NO_EXCEPTIONS
461 this->__set_badbit_and_consider_rethrow();
463 #endif // _LIBCPP_NO_EXCEPTIONS
467 template <class _CharT, class _Traits>
468 basic_istream<_CharT, _Traits>&
469 basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
471 #ifndef _LIBCPP_NO_EXCEPTIONS
474 #endif // _LIBCPP_NO_EXCEPTIONS
478 typedef istreambuf_iterator<char_type, traits_type> _I;
479 typedef num_get<char_type, _I> _F;
480 ios_base::iostate __err = ios_base::goodbit;
481 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
482 this->setstate(__err);
484 #ifndef _LIBCPP_NO_EXCEPTIONS
488 this->__set_badbit_and_consider_rethrow();
490 #endif // _LIBCPP_NO_EXCEPTIONS
494 template <class _CharT, class _Traits>
495 basic_istream<_CharT, _Traits>&
496 basic_istream<_CharT, _Traits>::operator>>(float& __n)
498 #ifndef _LIBCPP_NO_EXCEPTIONS
501 #endif // _LIBCPP_NO_EXCEPTIONS
505 typedef istreambuf_iterator<char_type, traits_type> _I;
506 typedef num_get<char_type, _I> _F;
507 ios_base::iostate __err = ios_base::goodbit;
508 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
509 this->setstate(__err);
511 #ifndef _LIBCPP_NO_EXCEPTIONS
515 this->__set_badbit_and_consider_rethrow();
517 #endif // _LIBCPP_NO_EXCEPTIONS
521 template <class _CharT, class _Traits>
522 basic_istream<_CharT, _Traits>&
523 basic_istream<_CharT, _Traits>::operator>>(double& __n)
525 #ifndef _LIBCPP_NO_EXCEPTIONS
528 #endif // _LIBCPP_NO_EXCEPTIONS
532 typedef istreambuf_iterator<char_type, traits_type> _I;
533 typedef num_get<char_type, _I> _F;
534 ios_base::iostate __err = ios_base::goodbit;
535 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
536 this->setstate(__err);
538 #ifndef _LIBCPP_NO_EXCEPTIONS
542 this->__set_badbit_and_consider_rethrow();
544 #endif // _LIBCPP_NO_EXCEPTIONS
548 template <class _CharT, class _Traits>
549 basic_istream<_CharT, _Traits>&
550 basic_istream<_CharT, _Traits>::operator>>(long double& __n)
552 #ifndef _LIBCPP_NO_EXCEPTIONS
555 #endif // _LIBCPP_NO_EXCEPTIONS
559 typedef istreambuf_iterator<char_type, traits_type> _I;
560 typedef num_get<char_type, _I> _F;
561 ios_base::iostate __err = ios_base::goodbit;
562 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
563 this->setstate(__err);
565 #ifndef _LIBCPP_NO_EXCEPTIONS
569 this->__set_badbit_and_consider_rethrow();
571 #endif // _LIBCPP_NO_EXCEPTIONS
575 template <class _CharT, class _Traits>
576 basic_istream<_CharT, _Traits>&
577 basic_istream<_CharT, _Traits>::operator>>(bool& __n)
579 #ifndef _LIBCPP_NO_EXCEPTIONS
582 #endif // _LIBCPP_NO_EXCEPTIONS
586 typedef istreambuf_iterator<char_type, traits_type> _I;
587 typedef num_get<char_type, _I> _F;
588 ios_base::iostate __err = ios_base::goodbit;
589 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
590 this->setstate(__err);
592 #ifndef _LIBCPP_NO_EXCEPTIONS
596 this->__set_badbit_and_consider_rethrow();
598 #endif // _LIBCPP_NO_EXCEPTIONS
602 template <class _CharT, class _Traits>
603 basic_istream<_CharT, _Traits>&
604 basic_istream<_CharT, _Traits>::operator>>(void*& __n)
606 #ifndef _LIBCPP_NO_EXCEPTIONS
609 #endif // _LIBCPP_NO_EXCEPTIONS
613 typedef istreambuf_iterator<char_type, traits_type> _I;
614 typedef num_get<char_type, _I> _F;
615 ios_base::iostate __err = ios_base::goodbit;
616 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
617 this->setstate(__err);
619 #ifndef _LIBCPP_NO_EXCEPTIONS
623 this->__set_badbit_and_consider_rethrow();
625 #endif // _LIBCPP_NO_EXCEPTIONS
629 template <class _CharT, class _Traits>
630 basic_istream<_CharT, _Traits>&
631 basic_istream<_CharT, _Traits>::operator>>(short& __n)
633 #ifndef _LIBCPP_NO_EXCEPTIONS
636 #endif // _LIBCPP_NO_EXCEPTIONS
640 typedef istreambuf_iterator<char_type, traits_type> _I;
641 typedef num_get<char_type, _I> _F;
642 ios_base::iostate __err = ios_base::goodbit;
644 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
645 if (__temp < numeric_limits<short>::min())
647 __err |= ios_base::failbit;
648 __n = numeric_limits<short>::min();
650 else if (__temp > numeric_limits<short>::max())
652 __err |= ios_base::failbit;
653 __n = numeric_limits<short>::max();
656 __n = static_cast<short>(__temp);
657 this->setstate(__err);
659 #ifndef _LIBCPP_NO_EXCEPTIONS
663 this->__set_badbit_and_consider_rethrow();
665 #endif // _LIBCPP_NO_EXCEPTIONS
669 template <class _CharT, class _Traits>
670 basic_istream<_CharT, _Traits>&
671 basic_istream<_CharT, _Traits>::operator>>(int& __n)
673 #ifndef _LIBCPP_NO_EXCEPTIONS
676 #endif // _LIBCPP_NO_EXCEPTIONS
680 typedef istreambuf_iterator<char_type, traits_type> _I;
681 typedef num_get<char_type, _I> _F;
682 ios_base::iostate __err = ios_base::goodbit;
684 use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
685 if (__temp < numeric_limits<int>::min())
687 __err |= ios_base::failbit;
688 __n = numeric_limits<int>::min();
690 else if (__temp > numeric_limits<int>::max())
692 __err |= ios_base::failbit;
693 __n = numeric_limits<int>::max();
696 __n = static_cast<int>(__temp);
697 this->setstate(__err);
699 #ifndef _LIBCPP_NO_EXCEPTIONS
703 this->__set_badbit_and_consider_rethrow();
705 #endif // _LIBCPP_NO_EXCEPTIONS
709 template <class _CharT, class _Traits>
710 inline _LIBCPP_INLINE_VISIBILITY
711 basic_istream<_CharT, _Traits>&
712 basic_istream<_CharT, _Traits>::operator>>(basic_istream& (*__pf)(basic_istream&))
717 template <class _CharT, class _Traits>
718 inline _LIBCPP_INLINE_VISIBILITY
719 basic_istream<_CharT, _Traits>&
720 basic_istream<_CharT, _Traits>::operator>>(basic_ios<char_type, traits_type>&
721 (*__pf)(basic_ios<char_type, traits_type>&))
727 template <class _CharT, class _Traits>
728 inline _LIBCPP_INLINE_VISIBILITY
729 basic_istream<_CharT, _Traits>&
730 basic_istream<_CharT, _Traits>::operator>>(ios_base& (*__pf)(ios_base&))
736 template<class _CharT, class _Traits>
737 basic_istream<_CharT, _Traits>&
738 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
740 #ifndef _LIBCPP_NO_EXCEPTIONS
743 #endif // _LIBCPP_NO_EXCEPTIONS
744 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
747 streamsize __n = __is.width();
749 __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
751 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
752 ios_base::iostate __err = ios_base::goodbit;
755 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
756 if (_Traits::eq_int_type(__i, _Traits::eof()))
758 __err |= ios_base::eofbit;
761 _CharT __ch = _Traits::to_char_type(__i);
762 if (__ct.is(__ct.space, __ch))
766 __is.rdbuf()->sbumpc();
771 __err |= ios_base::failbit;
772 __is.setstate(__err);
774 #ifndef _LIBCPP_NO_EXCEPTIONS
778 __is.__set_badbit_and_consider_rethrow();
780 #endif // _LIBCPP_NO_EXCEPTIONS
784 template<class _Traits>
785 inline _LIBCPP_INLINE_VISIBILITY
786 basic_istream<char, _Traits>&
787 operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
789 return __is >> (char*)__s;
792 template<class _Traits>
793 inline _LIBCPP_INLINE_VISIBILITY
794 basic_istream<char, _Traits>&
795 operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
797 return __is >> (char*)__s;
800 template<class _CharT, class _Traits>
801 basic_istream<_CharT, _Traits>&
802 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
804 #ifndef _LIBCPP_NO_EXCEPTIONS
807 #endif // _LIBCPP_NO_EXCEPTIONS
808 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
811 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
812 if (_Traits::eq_int_type(__i, _Traits::eof()))
813 __is.setstate(ios_base::eofbit | ios_base::failbit);
815 __c = _Traits::to_char_type(__i);
817 #ifndef _LIBCPP_NO_EXCEPTIONS
821 __is.__set_badbit_and_consider_rethrow();
823 #endif // _LIBCPP_NO_EXCEPTIONS
827 template<class _Traits>
828 inline _LIBCPP_INLINE_VISIBILITY
829 basic_istream<char, _Traits>&
830 operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
832 return __is >> (char&)__c;
835 template<class _Traits>
836 inline _LIBCPP_INLINE_VISIBILITY
837 basic_istream<char, _Traits>&
838 operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
840 return __is >> (char&)__c;
843 template<class _CharT, class _Traits>
844 basic_istream<_CharT, _Traits>&
845 basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
848 #ifndef _LIBCPP_NO_EXCEPTIONS
851 #endif // _LIBCPP_NO_EXCEPTIONS
852 sentry __s(*this, true);
857 #ifndef _LIBCPP_NO_EXCEPTIONS
860 #endif // _LIBCPP_NO_EXCEPTIONS
861 ios_base::iostate __err = ios_base::goodbit;
864 typename traits_type::int_type __i = this->rdbuf()->sgetc();
865 if (traits_type::eq_int_type(__i, _Traits::eof()))
867 __err |= ios_base::eofbit;
870 if (traits_type::eq_int_type(
871 __sb->sputc(traits_type::to_char_type(__i)),
875 this->rdbuf()->sbumpc();
878 __err |= ios_base::failbit;
879 this->setstate(__err);
880 #ifndef _LIBCPP_NO_EXCEPTIONS
885 this->__set_failbit_and_consider_rethrow();
887 #endif // _LIBCPP_NO_EXCEPTIONS
890 this->setstate(ios_base::failbit);
892 #ifndef _LIBCPP_NO_EXCEPTIONS
896 this->__set_badbit_and_consider_rethrow();
898 #endif // _LIBCPP_NO_EXCEPTIONS
902 template<class _CharT, class _Traits>
903 typename basic_istream<_CharT, _Traits>::int_type
904 basic_istream<_CharT, _Traits>::get()
907 int_type __r = traits_type::eof();
908 #ifndef _LIBCPP_NO_EXCEPTIONS
911 #endif // _LIBCPP_NO_EXCEPTIONS
912 sentry __s(*this, true);
915 __r = this->rdbuf()->sbumpc();
916 if (traits_type::eq_int_type(__r, traits_type::eof()))
917 this->setstate(ios_base::failbit | ios_base::eofbit);
921 #ifndef _LIBCPP_NO_EXCEPTIONS
925 this->__set_badbit_and_consider_rethrow();
927 #endif // _LIBCPP_NO_EXCEPTIONS
931 template<class _CharT, class _Traits>
932 inline _LIBCPP_INLINE_VISIBILITY
933 basic_istream<_CharT, _Traits>&
934 basic_istream<_CharT, _Traits>::get(char_type& __c)
936 int_type __ch = get();
937 if (__ch != traits_type::eof())
938 __c = traits_type::to_char_type(__ch);
942 template<class _CharT, class _Traits>
943 basic_istream<_CharT, _Traits>&
944 basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
947 #ifndef _LIBCPP_NO_EXCEPTIONS
950 #endif // _LIBCPP_NO_EXCEPTIONS
951 sentry __sen(*this, true);
956 ios_base::iostate __err = ios_base::goodbit;
957 while (__gc_ < __n-1)
959 int_type __i = this->rdbuf()->sgetc();
960 if (traits_type::eq_int_type(__i, traits_type::eof()))
962 __err |= ios_base::eofbit;
965 char_type __ch = traits_type::to_char_type(__i);
966 if (traits_type::eq(__ch, __dlm))
970 this->rdbuf()->sbumpc();
974 __err |= ios_base::failbit;
975 this->setstate(__err);
978 this->setstate(ios_base::failbit);
980 #ifndef _LIBCPP_NO_EXCEPTIONS
984 this->__set_badbit_and_consider_rethrow();
986 #endif // _LIBCPP_NO_EXCEPTIONS
990 template<class _CharT, class _Traits>
991 inline _LIBCPP_INLINE_VISIBILITY
992 basic_istream<_CharT, _Traits>&
993 basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n)
995 return get(__s, __n, this->widen('\n'));
998 template<class _CharT, class _Traits>
999 basic_istream<_CharT, _Traits>&
1000 basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
1004 #ifndef _LIBCPP_NO_EXCEPTIONS
1007 #endif // _LIBCPP_NO_EXCEPTIONS
1008 sentry __sen(*this, true);
1011 ios_base::iostate __err = ios_base::goodbit;
1012 #ifndef _LIBCPP_NO_EXCEPTIONS
1015 #endif // _LIBCPP_NO_EXCEPTIONS
1018 typename traits_type::int_type __i = this->rdbuf()->sgetc();
1019 if (traits_type::eq_int_type(__i, traits_type::eof()))
1021 __err |= ios_base::eofbit;
1024 char_type __ch = traits_type::to_char_type(__i);
1025 if (traits_type::eq(__ch, __dlm))
1027 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
1030 this->rdbuf()->sbumpc();
1032 #ifndef _LIBCPP_NO_EXCEPTIONS
1037 #endif // _LIBCPP_NO_EXCEPTIONS
1039 __err |= ios_base::failbit;
1040 this->setstate(__err);
1042 #ifndef _LIBCPP_NO_EXCEPTIONS
1046 this->__set_badbit_and_consider_rethrow();
1048 #endif // _LIBCPP_NO_EXCEPTIONS
1052 template<class _CharT, class _Traits>
1053 inline _LIBCPP_INLINE_VISIBILITY
1054 basic_istream<_CharT, _Traits>&
1055 basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb)
1057 return get(__sb, this->widen('\n'));
1060 template<class _CharT, class _Traits>
1061 basic_istream<_CharT, _Traits>&
1062 basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
1065 #ifndef _LIBCPP_NO_EXCEPTIONS
1068 #endif // _LIBCPP_NO_EXCEPTIONS
1069 sentry __sen(*this, true);
1072 ios_base::iostate __err = ios_base::goodbit;
1075 typename traits_type::int_type __i = this->rdbuf()->sgetc();
1076 if (traits_type::eq_int_type(__i, traits_type::eof()))
1078 __err |= ios_base::eofbit;
1081 char_type __ch = traits_type::to_char_type(__i);
1082 if (traits_type::eq(__ch, __dlm))
1084 this->rdbuf()->sbumpc();
1090 __err |= ios_base::failbit;
1094 this->rdbuf()->sbumpc();
1100 __err |= ios_base::failbit;
1101 this->setstate(__err);
1103 #ifndef _LIBCPP_NO_EXCEPTIONS
1107 this->__set_badbit_and_consider_rethrow();
1109 #endif // _LIBCPP_NO_EXCEPTIONS
1113 template<class _CharT, class _Traits>
1114 inline _LIBCPP_INLINE_VISIBILITY
1115 basic_istream<_CharT, _Traits>&
1116 basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n)
1118 return getline(__s, __n, this->widen('\n'));
1121 template<class _CharT, class _Traits>
1122 basic_istream<_CharT, _Traits>&
1123 basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
1126 #ifndef _LIBCPP_NO_EXCEPTIONS
1129 #endif // _LIBCPP_NO_EXCEPTIONS
1130 sentry __sen(*this, true);
1133 ios_base::iostate __err = ios_base::goodbit;
1134 if (__n == numeric_limits<streamsize>::max())
1138 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1139 if (traits_type::eq_int_type(__i, traits_type::eof()))
1141 __err |= ios_base::eofbit;
1145 char_type __ch = traits_type::to_char_type(__i);
1146 if (traits_type::eq(__ch, __dlm))
1154 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1155 if (traits_type::eq_int_type(__i, traits_type::eof()))
1157 __err |= ios_base::eofbit;
1161 char_type __ch = traits_type::to_char_type(__i);
1162 if (traits_type::eq(__ch, __dlm))
1166 this->setstate(__err);
1168 #ifndef _LIBCPP_NO_EXCEPTIONS
1172 this->__set_badbit_and_consider_rethrow();
1174 #endif // _LIBCPP_NO_EXCEPTIONS
1178 template<class _CharT, class _Traits>
1179 typename basic_istream<_CharT, _Traits>::int_type
1180 basic_istream<_CharT, _Traits>::peek()
1183 int_type __r = traits_type::eof();
1184 #ifndef _LIBCPP_NO_EXCEPTIONS
1187 #endif // _LIBCPP_NO_EXCEPTIONS
1188 sentry __sen(*this, true);
1190 __r = this->rdbuf()->sgetc();
1191 #ifndef _LIBCPP_NO_EXCEPTIONS
1195 this->__set_badbit_and_consider_rethrow();
1197 #endif // _LIBCPP_NO_EXCEPTIONS
1201 template<class _CharT, class _Traits>
1202 basic_istream<_CharT, _Traits>&
1203 basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
1206 #ifndef _LIBCPP_NO_EXCEPTIONS
1209 #endif // _LIBCPP_NO_EXCEPTIONS
1210 sentry __sen(*this, true);
1213 ios_base::iostate __err = ios_base::goodbit;
1214 for (; __gc_ < __n; ++__gc_)
1216 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1217 if (traits_type::eq_int_type(__i, traits_type::eof()))
1219 this->setstate(ios_base::failbit | ios_base::eofbit);
1222 *__s++ = traits_type::to_char_type(__i);
1226 this->setstate(ios_base::failbit);
1227 #ifndef _LIBCPP_NO_EXCEPTIONS
1231 this->__set_badbit_and_consider_rethrow();
1233 #endif // _LIBCPP_NO_EXCEPTIONS
1237 template<class _CharT, class _Traits>
1239 basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
1241 streamsize __c = this->rdbuf()->in_avail();
1245 this->setstate(ios_base::eofbit);
1250 read(__s, _VSTD::min(__c, __n));
1256 template<class _CharT, class _Traits>
1257 basic_istream<_CharT, _Traits>&
1258 basic_istream<_CharT, _Traits>::putback(char_type __c)
1261 #ifndef _LIBCPP_NO_EXCEPTIONS
1264 #endif // _LIBCPP_NO_EXCEPTIONS
1265 sentry __sen(*this, true);
1268 if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
1269 this->setstate(ios_base::badbit);
1272 this->setstate(ios_base::failbit);
1273 #ifndef _LIBCPP_NO_EXCEPTIONS
1277 this->__set_badbit_and_consider_rethrow();
1279 #endif // _LIBCPP_NO_EXCEPTIONS
1283 template<class _CharT, class _Traits>
1284 basic_istream<_CharT, _Traits>&
1285 basic_istream<_CharT, _Traits>::unget()
1288 #ifndef _LIBCPP_NO_EXCEPTIONS
1291 #endif // _LIBCPP_NO_EXCEPTIONS
1292 sentry __sen(*this, true);
1295 if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
1296 this->setstate(ios_base::badbit);
1299 this->setstate(ios_base::failbit);
1300 #ifndef _LIBCPP_NO_EXCEPTIONS
1304 this->__set_badbit_and_consider_rethrow();
1306 #endif // _LIBCPP_NO_EXCEPTIONS
1310 template<class _CharT, class _Traits>
1312 basic_istream<_CharT, _Traits>::sync()
1315 #ifndef _LIBCPP_NO_EXCEPTIONS
1318 #endif // _LIBCPP_NO_EXCEPTIONS
1319 sentry __sen(*this, true);
1322 if (this->rdbuf() == 0)
1324 if (this->rdbuf()->pubsync() == -1)
1326 this->setstate(ios_base::badbit);
1330 #ifndef _LIBCPP_NO_EXCEPTIONS
1334 this->__set_badbit_and_consider_rethrow();
1336 #endif // _LIBCPP_NO_EXCEPTIONS
1340 template<class _CharT, class _Traits>
1341 typename basic_istream<_CharT, _Traits>::pos_type
1342 basic_istream<_CharT, _Traits>::tellg()
1345 #ifndef _LIBCPP_NO_EXCEPTIONS
1348 #endif // _LIBCPP_NO_EXCEPTIONS
1349 sentry __sen(*this, true);
1351 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
1352 #ifndef _LIBCPP_NO_EXCEPTIONS
1356 this->__set_badbit_and_consider_rethrow();
1358 #endif // _LIBCPP_NO_EXCEPTIONS
1362 template<class _CharT, class _Traits>
1363 basic_istream<_CharT, _Traits>&
1364 basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
1366 #ifndef _LIBCPP_NO_EXCEPTIONS
1369 #endif // _LIBCPP_NO_EXCEPTIONS
1370 sentry __sen(*this, true);
1372 if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
1373 this->setstate(ios_base::failbit);
1374 #ifndef _LIBCPP_NO_EXCEPTIONS
1378 this->__set_badbit_and_consider_rethrow();
1380 #endif // _LIBCPP_NO_EXCEPTIONS
1384 template<class _CharT, class _Traits>
1385 basic_istream<_CharT, _Traits>&
1386 basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
1388 #ifndef _LIBCPP_NO_EXCEPTIONS
1391 #endif // _LIBCPP_NO_EXCEPTIONS
1392 sentry __sen(*this, true);
1394 this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
1395 #ifndef _LIBCPP_NO_EXCEPTIONS
1399 this->__set_badbit_and_consider_rethrow();
1401 #endif // _LIBCPP_NO_EXCEPTIONS
1405 template <class _CharT, class _Traits>
1406 basic_istream<_CharT, _Traits>&
1407 ws(basic_istream<_CharT, _Traits>& __is)
1409 #ifndef _LIBCPP_NO_EXCEPTIONS
1412 #endif // _LIBCPP_NO_EXCEPTIONS
1413 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1416 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1419 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1420 if (_Traits::eq_int_type(__i, _Traits::eof()))
1422 __is.setstate(ios_base::eofbit);
1425 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
1427 __is.rdbuf()->sbumpc();
1430 #ifndef _LIBCPP_NO_EXCEPTIONS
1434 __is.__set_badbit_and_consider_rethrow();
1436 #endif // _LIBCPP_NO_EXCEPTIONS
1440 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1442 template <class _CharT, class _Traits, class _Tp>
1443 inline _LIBCPP_INLINE_VISIBILITY
1444 basic_istream<_CharT, _Traits>&
1445 operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
1451 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1453 template <class _CharT, class _Traits>
1454 class _LIBCPP_VISIBLE basic_iostream
1455 : public basic_istream<_CharT, _Traits>,
1456 public basic_ostream<_CharT, _Traits>
1460 typedef _CharT char_type;
1461 typedef _Traits traits_type;
1462 typedef typename traits_type::int_type int_type;
1463 typedef typename traits_type::pos_type pos_type;
1464 typedef typename traits_type::off_type off_type;
1466 // constructor/destructor
1467 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb);
1468 virtual ~basic_iostream();
1470 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1471 _LIBCPP_INLINE_VISIBILITY
1472 basic_iostream(basic_iostream&& __rhs);
1476 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1477 _LIBCPP_INLINE_VISIBILITY
1478 basic_iostream& operator=(basic_iostream&& __rhs);
1480 void swap(basic_iostream& __rhs);
1484 template <class _CharT, class _Traits>
1485 inline _LIBCPP_INLINE_VISIBILITY
1486 basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
1487 : basic_istream<_CharT, _Traits>(__sb)
1491 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1493 template <class _CharT, class _Traits>
1494 inline _LIBCPP_INLINE_VISIBILITY
1495 basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
1496 : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
1500 template <class _CharT, class _Traits>
1501 inline _LIBCPP_INLINE_VISIBILITY
1502 basic_iostream<_CharT, _Traits>&
1503 basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
1509 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1511 template <class _CharT, class _Traits>
1512 basic_iostream<_CharT, _Traits>::~basic_iostream()
1516 template <class _CharT, class _Traits>
1517 inline _LIBCPP_INLINE_VISIBILITY
1519 basic_iostream<_CharT, _Traits>::swap(basic_iostream& __rhs)
1521 basic_istream<char_type, traits_type>::swap(__rhs);
1524 template<class _CharT, class _Traits, class _Allocator>
1525 basic_istream<_CharT, _Traits>&
1526 operator>>(basic_istream<_CharT, _Traits>& __is,
1527 basic_string<_CharT, _Traits, _Allocator>& __str)
1529 #ifndef _LIBCPP_NO_EXCEPTIONS
1532 #endif // _LIBCPP_NO_EXCEPTIONS
1533 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1537 streamsize __n = __is.width();
1539 __n = __str.max_size();
1541 __n = numeric_limits<streamsize>::max();
1543 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1544 ios_base::iostate __err = ios_base::goodbit;
1547 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1548 if (_Traits::eq_int_type(__i, _Traits::eof()))
1550 __err |= ios_base::eofbit;
1553 _CharT __ch = _Traits::to_char_type(__i);
1554 if (__ct.is(__ct.space, __ch))
1556 __str.push_back(__ch);
1558 __is.rdbuf()->sbumpc();
1562 __err |= ios_base::failbit;
1563 __is.setstate(__err);
1566 __is.setstate(ios_base::failbit);
1567 #ifndef _LIBCPP_NO_EXCEPTIONS
1571 __is.__set_badbit_and_consider_rethrow();
1573 #endif // _LIBCPP_NO_EXCEPTIONS
1577 template<class _CharT, class _Traits, class _Allocator>
1578 basic_istream<_CharT, _Traits>&
1579 getline(basic_istream<_CharT, _Traits>& __is,
1580 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1582 #ifndef _LIBCPP_NO_EXCEPTIONS
1585 #endif // _LIBCPP_NO_EXCEPTIONS
1586 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1590 ios_base::iostate __err = ios_base::goodbit;
1591 streamsize __extr = 0;
1594 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
1595 if (_Traits::eq_int_type(__i, _Traits::eof()))
1597 __err |= ios_base::eofbit;
1601 _CharT __ch = _Traits::to_char_type(__i);
1602 if (_Traits::eq(__ch, __dlm))
1604 __str.push_back(__ch);
1605 if (__str.size() == __str.max_size())
1607 __err |= ios_base::failbit;
1612 __err |= ios_base::failbit;
1613 __is.setstate(__err);
1615 #ifndef _LIBCPP_NO_EXCEPTIONS
1619 __is.__set_badbit_and_consider_rethrow();
1621 #endif // _LIBCPP_NO_EXCEPTIONS
1625 template<class _CharT, class _Traits, class _Allocator>
1626 inline _LIBCPP_INLINE_VISIBILITY
1627 basic_istream<_CharT, _Traits>&
1628 getline(basic_istream<_CharT, _Traits>& __is,
1629 basic_string<_CharT, _Traits, _Allocator>& __str)
1631 return getline(__is, __str, __is.widen('\n'));
1634 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1636 template<class _CharT, class _Traits, class _Allocator>
1637 inline _LIBCPP_INLINE_VISIBILITY
1638 basic_istream<_CharT, _Traits>&
1639 getline(basic_istream<_CharT, _Traits>&& __is,
1640 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1642 return getline(__is, __str, __dlm);
1645 template<class _CharT, class _Traits, class _Allocator>
1646 inline _LIBCPP_INLINE_VISIBILITY
1647 basic_istream<_CharT, _Traits>&
1648 getline(basic_istream<_CharT, _Traits>&& __is,
1649 basic_string<_CharT, _Traits, _Allocator>& __str)
1651 return getline(__is, __str, __is.widen('\n'));
1654 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1656 template <class _CharT, class _Traits, size_t _Size>
1657 basic_istream<_CharT, _Traits>&
1658 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1660 #ifndef _LIBCPP_NO_EXCEPTIONS
1663 #endif // _LIBCPP_NO_EXCEPTIONS
1664 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1667 basic_string<_CharT, _Traits> __str;
1668 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1670 ios_base::iostate __err = ios_base::goodbit;
1671 _CharT __zero = __ct.widen('0');
1672 _CharT __one = __ct.widen('1');
1675 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1676 if (_Traits::eq_int_type(__i, _Traits::eof()))
1678 __err |= ios_base::eofbit;
1681 _CharT __ch = _Traits::to_char_type(__i);
1682 if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
1684 __str.push_back(__ch);
1686 __is.rdbuf()->sbumpc();
1688 __x = bitset<_Size>(__str);
1690 __err |= ios_base::failbit;
1691 __is.setstate(__err);
1694 __is.setstate(ios_base::failbit);
1695 #ifndef _LIBCPP_NO_EXCEPTIONS
1699 __is.__set_badbit_and_consider_rethrow();
1701 #endif // _LIBCPP_NO_EXCEPTIONS
1705 extern template class basic_istream<char>;
1706 extern template class basic_istream<wchar_t>;
1707 extern template class basic_iostream<char>;
1709 _LIBCPP_END_NAMESPACE_STD
1711 #endif // _LIBCPP_ISTREAM