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);
86 basic_istream(const basic_istream& rhs) = delete;
87 basic_istream(basic_istream&& rhs);
88 // 27.7.2.1.2 Assign/swap:
89 basic_istream& operator=(const basic_istream& rhs) = delete;
90 basic_istream& operator=(basic_istream&& rhs);
91 void swap(basic_istream& rhs);
94 // 27.7.1.2.3 character extraction templates:
95 template<class charT, class traits>
96 basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT&);
98 template<class traits>
99 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char&);
101 template<class traits>
102 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char&);
104 template<class charT, class traits>
105 basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT*);
107 template<class traits>
108 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char*);
110 template<class traits>
111 basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char*);
113 template <class charT, class traits>
115 swap(basic_istream<charT, traits>& x, basic_istream<charT, traits>& y);
117 typedef basic_istream<char> istream;
118 typedef basic_istream<wchar_t> wistream;
120 template <class charT, class traits = char_traits<charT> >
121 class basic_iostream :
122 public basic_istream<charT,traits>,
123 public basic_ostream<charT,traits>
127 typedef charT char_type;
128 typedef traits traits_type;
129 typedef typename traits_type::int_type int_type;
130 typedef typename traits_type::pos_type pos_type;
131 typedef typename traits_type::off_type off_type;
133 // constructor/destructor
134 explicit basic_iostream(basic_streambuf<char_type, traits_type>* sb);
135 basic_iostream(basic_iostream&& rhs);
136 virtual ~basic_iostream();
139 basic_iostream& operator=(basic_iostream&& rhs);
140 void swap(basic_iostream& rhs);
143 template <class charT, class traits>
145 swap(basic_iostream<charT, traits>& x, basic_iostream<charT, traits>& y);
147 typedef basic_iostream<char> iostream;
148 typedef basic_iostream<wchar_t> wiostream;
150 template <class charT, class traits>
151 basic_istream<charT,traits>&
152 ws(basic_istream<charT,traits>& is);
154 template <class charT, class traits, class T>
155 basic_istream<charT, traits>&
156 operator>>(basic_istream<charT, traits>&& is, T& x);
165 #include <__undef_min_max>
167 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
168 #pragma GCC system_header
171 _LIBCPP_BEGIN_NAMESPACE_STD
173 template <class _CharT, class _Traits>
174 class _LIBCPP_TEMPLATE_VIS basic_istream
175 : virtual public basic_ios<_CharT, _Traits>
179 // types (inherited from basic_ios (27.5.4)):
180 typedef _CharT char_type;
181 typedef _Traits traits_type;
182 typedef typename traits_type::int_type int_type;
183 typedef typename traits_type::pos_type pos_type;
184 typedef typename traits_type::off_type off_type;
186 // 27.7.1.1.1 Constructor/destructor:
187 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
188 explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb) : __gc_(0)
189 { this->init(__sb); }
190 virtual ~basic_istream();
192 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
193 inline _LIBCPP_INLINE_VISIBILITY
194 basic_istream(basic_istream&& __rhs);
196 // 27.7.1.1.2 Assign/swap:
197 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
198 inline _LIBCPP_INLINE_VISIBILITY
199 basic_istream& operator=(basic_istream&& __rhs);
202 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
203 void swap(basic_istream& __rhs) {
204 _VSTD::swap(__gc_, __rhs.__gc_);
205 basic_ios<char_type, traits_type>::swap(__rhs);
208 #ifndef _LIBCPP_CXX03_LANG
209 basic_istream (const basic_istream& __rhs) = delete;
210 basic_istream& operator=(const basic_istream& __rhs) = delete;
214 // 27.7.1.1.3 Prefix/suffix:
215 class _LIBCPP_TEMPLATE_VIS sentry;
217 // 27.7.1.2 Formatted input:
218 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
219 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&))
220 { return __pf(*this); }
222 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
223 basic_istream& operator>>(basic_ios<char_type, traits_type>&
224 (*__pf)(basic_ios<char_type, traits_type>&))
225 { __pf(*this); return *this; }
227 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
228 basic_istream& operator>>(ios_base& (*__pf)(ios_base&))
229 { __pf(*this); return *this; }
231 basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
232 basic_istream& operator>>(bool& __n);
233 basic_istream& operator>>(short& __n);
234 basic_istream& operator>>(unsigned short& __n);
235 basic_istream& operator>>(int& __n);
236 basic_istream& operator>>(unsigned int& __n);
237 basic_istream& operator>>(long& __n);
238 basic_istream& operator>>(unsigned long& __n);
239 basic_istream& operator>>(long long& __n);
240 basic_istream& operator>>(unsigned long long& __n);
241 basic_istream& operator>>(float& __f);
242 basic_istream& operator>>(double& __f);
243 basic_istream& operator>>(long double& __f);
244 basic_istream& operator>>(void*& __p);
246 // 27.7.1.3 Unformatted input:
247 _LIBCPP_INLINE_VISIBILITY
248 streamsize gcount() const {return __gc_;}
251 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
252 basic_istream& get(char_type& __c) {
253 int_type __ch = get();
254 if (__ch != traits_type::eof())
255 __c = traits_type::to_char_type(__ch);
259 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
260 basic_istream& get(char_type* __s, streamsize __n)
261 { return get(__s, __n, this->widen('\n')); }
263 basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
265 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
266 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb)
267 { return get(__sb, this->widen('\n')); }
269 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
271 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
272 basic_istream& getline(char_type* __s, streamsize __n)
273 { return getline(__s, __n, this->widen('\n')); }
275 basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
277 basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
279 basic_istream& read (char_type* __s, streamsize __n);
280 streamsize readsome(char_type* __s, streamsize __n);
282 basic_istream& putback(char_type __c);
283 basic_istream& unget();
287 basic_istream& seekg(pos_type __pos);
288 basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
291 template <class _CharT, class _Traits>
292 class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry
296 sentry(const sentry&); // = delete;
297 sentry& operator=(const sentry&); // = delete;
300 explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
301 // ~sentry() = default;
303 _LIBCPP_INLINE_VISIBILITY
305 operator bool() const {return __ok_;}
308 template <class _CharT, class _Traits>
309 basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is,
317 if (!__noskipws && (__is.flags() & ios_base::skipws))
319 typedef istreambuf_iterator<_CharT, _Traits> _Ip;
320 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
323 for (; __i != __eof; ++__i)
324 if (!__ct.is(__ct.space, *__i))
327 __is.setstate(ios_base::failbit | ios_base::eofbit);
332 __is.setstate(ios_base::failbit);
335 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
337 template <class _CharT, class _Traits>
338 basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
345 template <class _CharT, class _Traits>
346 basic_istream<_CharT, _Traits>&
347 basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
353 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
355 template <class _CharT, class _Traits>
356 basic_istream<_CharT, _Traits>::~basic_istream()
360 template <class _CharT, class _Traits>
361 basic_istream<_CharT, _Traits>&
362 basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
364 #ifndef _LIBCPP_NO_EXCEPTIONS
367 #endif // _LIBCPP_NO_EXCEPTIONS
371 typedef istreambuf_iterator<char_type, traits_type> _Ip;
372 typedef num_get<char_type, _Ip> _Fp;
373 ios_base::iostate __err = ios_base::goodbit;
374 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
375 this->setstate(__err);
377 #ifndef _LIBCPP_NO_EXCEPTIONS
381 this->__set_badbit_and_consider_rethrow();
383 #endif // _LIBCPP_NO_EXCEPTIONS
387 template <class _CharT, class _Traits>
388 basic_istream<_CharT, _Traits>&
389 basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
391 #ifndef _LIBCPP_NO_EXCEPTIONS
394 #endif // _LIBCPP_NO_EXCEPTIONS
398 typedef istreambuf_iterator<char_type, traits_type> _Ip;
399 typedef num_get<char_type, _Ip> _Fp;
400 ios_base::iostate __err = ios_base::goodbit;
401 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
402 this->setstate(__err);
404 #ifndef _LIBCPP_NO_EXCEPTIONS
408 this->__set_badbit_and_consider_rethrow();
410 #endif // _LIBCPP_NO_EXCEPTIONS
414 template <class _CharT, class _Traits>
415 basic_istream<_CharT, _Traits>&
416 basic_istream<_CharT, _Traits>::operator>>(long& __n)
418 #ifndef _LIBCPP_NO_EXCEPTIONS
421 #endif // _LIBCPP_NO_EXCEPTIONS
425 typedef istreambuf_iterator<char_type, traits_type> _Ip;
426 typedef num_get<char_type, _Ip> _Fp;
427 ios_base::iostate __err = ios_base::goodbit;
428 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
429 this->setstate(__err);
431 #ifndef _LIBCPP_NO_EXCEPTIONS
435 this->__set_badbit_and_consider_rethrow();
437 #endif // _LIBCPP_NO_EXCEPTIONS
441 template <class _CharT, class _Traits>
442 basic_istream<_CharT, _Traits>&
443 basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
445 #ifndef _LIBCPP_NO_EXCEPTIONS
448 #endif // _LIBCPP_NO_EXCEPTIONS
452 typedef istreambuf_iterator<char_type, traits_type> _Ip;
453 typedef num_get<char_type, _Ip> _Fp;
454 ios_base::iostate __err = ios_base::goodbit;
455 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
456 this->setstate(__err);
458 #ifndef _LIBCPP_NO_EXCEPTIONS
462 this->__set_badbit_and_consider_rethrow();
464 #endif // _LIBCPP_NO_EXCEPTIONS
468 template <class _CharT, class _Traits>
469 basic_istream<_CharT, _Traits>&
470 basic_istream<_CharT, _Traits>::operator>>(long long& __n)
472 #ifndef _LIBCPP_NO_EXCEPTIONS
475 #endif // _LIBCPP_NO_EXCEPTIONS
479 typedef istreambuf_iterator<char_type, traits_type> _Ip;
480 typedef num_get<char_type, _Ip> _Fp;
481 ios_base::iostate __err = ios_base::goodbit;
482 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
483 this->setstate(__err);
485 #ifndef _LIBCPP_NO_EXCEPTIONS
489 this->__set_badbit_and_consider_rethrow();
491 #endif // _LIBCPP_NO_EXCEPTIONS
495 template <class _CharT, class _Traits>
496 basic_istream<_CharT, _Traits>&
497 basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
499 #ifndef _LIBCPP_NO_EXCEPTIONS
502 #endif // _LIBCPP_NO_EXCEPTIONS
506 typedef istreambuf_iterator<char_type, traits_type> _Ip;
507 typedef num_get<char_type, _Ip> _Fp;
508 ios_base::iostate __err = ios_base::goodbit;
509 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
510 this->setstate(__err);
512 #ifndef _LIBCPP_NO_EXCEPTIONS
516 this->__set_badbit_and_consider_rethrow();
518 #endif // _LIBCPP_NO_EXCEPTIONS
522 template <class _CharT, class _Traits>
523 basic_istream<_CharT, _Traits>&
524 basic_istream<_CharT, _Traits>::operator>>(float& __n)
526 #ifndef _LIBCPP_NO_EXCEPTIONS
529 #endif // _LIBCPP_NO_EXCEPTIONS
533 typedef istreambuf_iterator<char_type, traits_type> _Ip;
534 typedef num_get<char_type, _Ip> _Fp;
535 ios_base::iostate __err = ios_base::goodbit;
536 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
537 this->setstate(__err);
539 #ifndef _LIBCPP_NO_EXCEPTIONS
543 this->__set_badbit_and_consider_rethrow();
545 #endif // _LIBCPP_NO_EXCEPTIONS
549 template <class _CharT, class _Traits>
550 basic_istream<_CharT, _Traits>&
551 basic_istream<_CharT, _Traits>::operator>>(double& __n)
553 #ifndef _LIBCPP_NO_EXCEPTIONS
556 #endif // _LIBCPP_NO_EXCEPTIONS
560 typedef istreambuf_iterator<char_type, traits_type> _Ip;
561 typedef num_get<char_type, _Ip> _Fp;
562 ios_base::iostate __err = ios_base::goodbit;
563 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
564 this->setstate(__err);
566 #ifndef _LIBCPP_NO_EXCEPTIONS
570 this->__set_badbit_and_consider_rethrow();
572 #endif // _LIBCPP_NO_EXCEPTIONS
576 template <class _CharT, class _Traits>
577 basic_istream<_CharT, _Traits>&
578 basic_istream<_CharT, _Traits>::operator>>(long double& __n)
580 #ifndef _LIBCPP_NO_EXCEPTIONS
583 #endif // _LIBCPP_NO_EXCEPTIONS
587 typedef istreambuf_iterator<char_type, traits_type> _Ip;
588 typedef num_get<char_type, _Ip> _Fp;
589 ios_base::iostate __err = ios_base::goodbit;
590 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
591 this->setstate(__err);
593 #ifndef _LIBCPP_NO_EXCEPTIONS
597 this->__set_badbit_and_consider_rethrow();
599 #endif // _LIBCPP_NO_EXCEPTIONS
603 template <class _CharT, class _Traits>
604 basic_istream<_CharT, _Traits>&
605 basic_istream<_CharT, _Traits>::operator>>(bool& __n)
607 #ifndef _LIBCPP_NO_EXCEPTIONS
610 #endif // _LIBCPP_NO_EXCEPTIONS
614 typedef istreambuf_iterator<char_type, traits_type> _Ip;
615 typedef num_get<char_type, _Ip> _Fp;
616 ios_base::iostate __err = ios_base::goodbit;
617 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
618 this->setstate(__err);
620 #ifndef _LIBCPP_NO_EXCEPTIONS
624 this->__set_badbit_and_consider_rethrow();
626 #endif // _LIBCPP_NO_EXCEPTIONS
630 template <class _CharT, class _Traits>
631 basic_istream<_CharT, _Traits>&
632 basic_istream<_CharT, _Traits>::operator>>(void*& __n)
634 #ifndef _LIBCPP_NO_EXCEPTIONS
637 #endif // _LIBCPP_NO_EXCEPTIONS
641 typedef istreambuf_iterator<char_type, traits_type> _Ip;
642 typedef num_get<char_type, _Ip> _Fp;
643 ios_base::iostate __err = ios_base::goodbit;
644 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
645 this->setstate(__err);
647 #ifndef _LIBCPP_NO_EXCEPTIONS
651 this->__set_badbit_and_consider_rethrow();
653 #endif // _LIBCPP_NO_EXCEPTIONS
657 template <class _CharT, class _Traits>
658 basic_istream<_CharT, _Traits>&
659 basic_istream<_CharT, _Traits>::operator>>(short& __n)
661 #ifndef _LIBCPP_NO_EXCEPTIONS
664 #endif // _LIBCPP_NO_EXCEPTIONS
668 typedef istreambuf_iterator<char_type, traits_type> _Ip;
669 typedef num_get<char_type, _Ip> _Fp;
670 ios_base::iostate __err = ios_base::goodbit;
672 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
673 if (__temp < numeric_limits<short>::min())
675 __err |= ios_base::failbit;
676 __n = numeric_limits<short>::min();
678 else if (__temp > numeric_limits<short>::max())
680 __err |= ios_base::failbit;
681 __n = numeric_limits<short>::max();
684 __n = static_cast<short>(__temp);
685 this->setstate(__err);
687 #ifndef _LIBCPP_NO_EXCEPTIONS
691 this->__set_badbit_and_consider_rethrow();
693 #endif // _LIBCPP_NO_EXCEPTIONS
697 template <class _CharT, class _Traits>
698 basic_istream<_CharT, _Traits>&
699 basic_istream<_CharT, _Traits>::operator>>(int& __n)
701 #ifndef _LIBCPP_NO_EXCEPTIONS
704 #endif // _LIBCPP_NO_EXCEPTIONS
708 typedef istreambuf_iterator<char_type, traits_type> _Ip;
709 typedef num_get<char_type, _Ip> _Fp;
710 ios_base::iostate __err = ios_base::goodbit;
712 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
713 if (__temp < numeric_limits<int>::min())
715 __err |= ios_base::failbit;
716 __n = numeric_limits<int>::min();
718 else if (__temp > numeric_limits<int>::max())
720 __err |= ios_base::failbit;
721 __n = numeric_limits<int>::max();
724 __n = static_cast<int>(__temp);
725 this->setstate(__err);
727 #ifndef _LIBCPP_NO_EXCEPTIONS
731 this->__set_badbit_and_consider_rethrow();
733 #endif // _LIBCPP_NO_EXCEPTIONS
737 template<class _CharT, class _Traits>
738 basic_istream<_CharT, _Traits>&
739 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
741 #ifndef _LIBCPP_NO_EXCEPTIONS
744 #endif // _LIBCPP_NO_EXCEPTIONS
745 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
748 streamsize __n = __is.width();
750 __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
752 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
753 ios_base::iostate __err = ios_base::goodbit;
756 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
757 if (_Traits::eq_int_type(__i, _Traits::eof()))
759 __err |= ios_base::eofbit;
762 _CharT __ch = _Traits::to_char_type(__i);
763 if (__ct.is(__ct.space, __ch))
767 __is.rdbuf()->sbumpc();
772 __err |= ios_base::failbit;
773 __is.setstate(__err);
775 #ifndef _LIBCPP_NO_EXCEPTIONS
779 __is.__set_badbit_and_consider_rethrow();
781 #endif // _LIBCPP_NO_EXCEPTIONS
785 template<class _Traits>
786 inline _LIBCPP_INLINE_VISIBILITY
787 basic_istream<char, _Traits>&
788 operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
790 return __is >> (char*)__s;
793 template<class _Traits>
794 inline _LIBCPP_INLINE_VISIBILITY
795 basic_istream<char, _Traits>&
796 operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
798 return __is >> (char*)__s;
801 template<class _CharT, class _Traits>
802 basic_istream<_CharT, _Traits>&
803 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
805 #ifndef _LIBCPP_NO_EXCEPTIONS
808 #endif // _LIBCPP_NO_EXCEPTIONS
809 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
812 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
813 if (_Traits::eq_int_type(__i, _Traits::eof()))
814 __is.setstate(ios_base::eofbit | ios_base::failbit);
816 __c = _Traits::to_char_type(__i);
818 #ifndef _LIBCPP_NO_EXCEPTIONS
822 __is.__set_badbit_and_consider_rethrow();
824 #endif // _LIBCPP_NO_EXCEPTIONS
828 template<class _Traits>
829 inline _LIBCPP_INLINE_VISIBILITY
830 basic_istream<char, _Traits>&
831 operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
833 return __is >> (char&)__c;
836 template<class _Traits>
837 inline _LIBCPP_INLINE_VISIBILITY
838 basic_istream<char, _Traits>&
839 operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
841 return __is >> (char&)__c;
844 template<class _CharT, class _Traits>
845 basic_istream<_CharT, _Traits>&
846 basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
849 #ifndef _LIBCPP_NO_EXCEPTIONS
852 #endif // _LIBCPP_NO_EXCEPTIONS
853 sentry __s(*this, true);
858 #ifndef _LIBCPP_NO_EXCEPTIONS
861 #endif // _LIBCPP_NO_EXCEPTIONS
862 ios_base::iostate __err = ios_base::goodbit;
865 typename traits_type::int_type __i = this->rdbuf()->sgetc();
866 if (traits_type::eq_int_type(__i, _Traits::eof()))
868 __err |= ios_base::eofbit;
871 if (traits_type::eq_int_type(
872 __sb->sputc(traits_type::to_char_type(__i)),
876 this->rdbuf()->sbumpc();
879 __err |= ios_base::failbit;
880 this->setstate(__err);
881 #ifndef _LIBCPP_NO_EXCEPTIONS
886 this->__set_failbit_and_consider_rethrow();
888 #endif // _LIBCPP_NO_EXCEPTIONS
891 this->setstate(ios_base::failbit);
893 #ifndef _LIBCPP_NO_EXCEPTIONS
897 this->__set_badbit_and_consider_rethrow();
899 #endif // _LIBCPP_NO_EXCEPTIONS
903 template<class _CharT, class _Traits>
904 typename basic_istream<_CharT, _Traits>::int_type
905 basic_istream<_CharT, _Traits>::get()
908 int_type __r = traits_type::eof();
909 #ifndef _LIBCPP_NO_EXCEPTIONS
912 #endif // _LIBCPP_NO_EXCEPTIONS
913 sentry __s(*this, true);
916 __r = this->rdbuf()->sbumpc();
917 if (traits_type::eq_int_type(__r, traits_type::eof()))
918 this->setstate(ios_base::failbit | ios_base::eofbit);
922 #ifndef _LIBCPP_NO_EXCEPTIONS
926 this->__set_badbit_and_consider_rethrow();
928 #endif // _LIBCPP_NO_EXCEPTIONS
932 template<class _CharT, class _Traits>
933 basic_istream<_CharT, _Traits>&
934 basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
937 #ifndef _LIBCPP_NO_EXCEPTIONS
940 #endif // _LIBCPP_NO_EXCEPTIONS
941 sentry __sen(*this, true);
946 ios_base::iostate __err = ios_base::goodbit;
947 while (__gc_ < __n-1)
949 int_type __i = this->rdbuf()->sgetc();
950 if (traits_type::eq_int_type(__i, traits_type::eof()))
952 __err |= ios_base::eofbit;
955 char_type __ch = traits_type::to_char_type(__i);
956 if (traits_type::eq(__ch, __dlm))
960 this->rdbuf()->sbumpc();
964 __err |= ios_base::failbit;
965 this->setstate(__err);
968 this->setstate(ios_base::failbit);
970 #ifndef _LIBCPP_NO_EXCEPTIONS
974 this->__set_badbit_and_consider_rethrow();
976 #endif // _LIBCPP_NO_EXCEPTIONS
980 template<class _CharT, class _Traits>
981 basic_istream<_CharT, _Traits>&
982 basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
986 #ifndef _LIBCPP_NO_EXCEPTIONS
989 #endif // _LIBCPP_NO_EXCEPTIONS
990 sentry __sen(*this, true);
993 ios_base::iostate __err = ios_base::goodbit;
994 #ifndef _LIBCPP_NO_EXCEPTIONS
997 #endif // _LIBCPP_NO_EXCEPTIONS
1000 typename traits_type::int_type __i = this->rdbuf()->sgetc();
1001 if (traits_type::eq_int_type(__i, traits_type::eof()))
1003 __err |= ios_base::eofbit;
1006 char_type __ch = traits_type::to_char_type(__i);
1007 if (traits_type::eq(__ch, __dlm))
1009 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
1012 this->rdbuf()->sbumpc();
1014 #ifndef _LIBCPP_NO_EXCEPTIONS
1019 #endif // _LIBCPP_NO_EXCEPTIONS
1021 __err |= ios_base::failbit;
1022 this->setstate(__err);
1024 #ifndef _LIBCPP_NO_EXCEPTIONS
1028 this->__set_badbit_and_consider_rethrow();
1030 #endif // _LIBCPP_NO_EXCEPTIONS
1034 template<class _CharT, class _Traits>
1035 basic_istream<_CharT, _Traits>&
1036 basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
1039 #ifndef _LIBCPP_NO_EXCEPTIONS
1042 #endif // _LIBCPP_NO_EXCEPTIONS
1043 sentry __sen(*this, true);
1046 ios_base::iostate __err = ios_base::goodbit;
1049 typename traits_type::int_type __i = this->rdbuf()->sgetc();
1050 if (traits_type::eq_int_type(__i, traits_type::eof()))
1052 __err |= ios_base::eofbit;
1055 char_type __ch = traits_type::to_char_type(__i);
1056 if (traits_type::eq(__ch, __dlm))
1058 this->rdbuf()->sbumpc();
1064 __err |= ios_base::failbit;
1068 this->rdbuf()->sbumpc();
1074 __err |= ios_base::failbit;
1075 this->setstate(__err);
1077 #ifndef _LIBCPP_NO_EXCEPTIONS
1081 this->__set_badbit_and_consider_rethrow();
1083 #endif // _LIBCPP_NO_EXCEPTIONS
1087 template<class _CharT, class _Traits>
1088 basic_istream<_CharT, _Traits>&
1089 basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
1092 #ifndef _LIBCPP_NO_EXCEPTIONS
1095 #endif // _LIBCPP_NO_EXCEPTIONS
1096 sentry __sen(*this, true);
1099 ios_base::iostate __err = ios_base::goodbit;
1100 if (__n == numeric_limits<streamsize>::max())
1104 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1105 if (traits_type::eq_int_type(__i, traits_type::eof()))
1107 __err |= ios_base::eofbit;
1111 if (traits_type::eq_int_type(__i, __dlm))
1119 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1120 if (traits_type::eq_int_type(__i, traits_type::eof()))
1122 __err |= ios_base::eofbit;
1126 if (traits_type::eq_int_type(__i, __dlm))
1130 this->setstate(__err);
1132 #ifndef _LIBCPP_NO_EXCEPTIONS
1136 this->__set_badbit_and_consider_rethrow();
1138 #endif // _LIBCPP_NO_EXCEPTIONS
1142 template<class _CharT, class _Traits>
1143 typename basic_istream<_CharT, _Traits>::int_type
1144 basic_istream<_CharT, _Traits>::peek()
1147 int_type __r = traits_type::eof();
1148 #ifndef _LIBCPP_NO_EXCEPTIONS
1151 #endif // _LIBCPP_NO_EXCEPTIONS
1152 sentry __sen(*this, true);
1155 __r = this->rdbuf()->sgetc();
1156 if (traits_type::eq_int_type(__r, traits_type::eof()))
1157 this->setstate(ios_base::eofbit);
1159 #ifndef _LIBCPP_NO_EXCEPTIONS
1163 this->__set_badbit_and_consider_rethrow();
1165 #endif // _LIBCPP_NO_EXCEPTIONS
1169 template<class _CharT, class _Traits>
1170 basic_istream<_CharT, _Traits>&
1171 basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
1174 #ifndef _LIBCPP_NO_EXCEPTIONS
1177 #endif // _LIBCPP_NO_EXCEPTIONS
1178 sentry __sen(*this, true);
1181 __gc_ = this->rdbuf()->sgetn(__s, __n);
1183 this->setstate(ios_base::failbit | ios_base::eofbit);
1186 this->setstate(ios_base::failbit);
1187 #ifndef _LIBCPP_NO_EXCEPTIONS
1191 this->__set_badbit_and_consider_rethrow();
1193 #endif // _LIBCPP_NO_EXCEPTIONS
1197 template<class _CharT, class _Traits>
1199 basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
1202 #ifndef _LIBCPP_NO_EXCEPTIONS
1205 #endif // _LIBCPP_NO_EXCEPTIONS
1206 sentry __sen(*this, true);
1209 streamsize __c = this->rdbuf()->in_avail();
1213 this->setstate(ios_base::eofbit);
1218 read(__s, _VSTD::min(__c, __n));
1223 this->setstate(ios_base::failbit);
1224 #ifndef _LIBCPP_NO_EXCEPTIONS
1228 this->__set_badbit_and_consider_rethrow();
1230 #endif // _LIBCPP_NO_EXCEPTIONS
1234 template<class _CharT, class _Traits>
1235 basic_istream<_CharT, _Traits>&
1236 basic_istream<_CharT, _Traits>::putback(char_type __c)
1239 #ifndef _LIBCPP_NO_EXCEPTIONS
1242 #endif // _LIBCPP_NO_EXCEPTIONS
1243 this->clear(this->rdstate() & ~ios_base::eofbit);
1244 sentry __sen(*this, true);
1247 if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
1248 this->setstate(ios_base::badbit);
1251 this->setstate(ios_base::failbit);
1252 #ifndef _LIBCPP_NO_EXCEPTIONS
1256 this->__set_badbit_and_consider_rethrow();
1258 #endif // _LIBCPP_NO_EXCEPTIONS
1262 template<class _CharT, class _Traits>
1263 basic_istream<_CharT, _Traits>&
1264 basic_istream<_CharT, _Traits>::unget()
1267 #ifndef _LIBCPP_NO_EXCEPTIONS
1270 #endif // _LIBCPP_NO_EXCEPTIONS
1271 this->clear(this->rdstate() & ~ios_base::eofbit);
1272 sentry __sen(*this, true);
1275 if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
1276 this->setstate(ios_base::badbit);
1279 this->setstate(ios_base::failbit);
1280 #ifndef _LIBCPP_NO_EXCEPTIONS
1284 this->__set_badbit_and_consider_rethrow();
1286 #endif // _LIBCPP_NO_EXCEPTIONS
1290 template<class _CharT, class _Traits>
1292 basic_istream<_CharT, _Traits>::sync()
1295 #ifndef _LIBCPP_NO_EXCEPTIONS
1298 #endif // _LIBCPP_NO_EXCEPTIONS
1299 sentry __sen(*this, true);
1302 if (this->rdbuf() == 0)
1304 if (this->rdbuf()->pubsync() == -1)
1306 this->setstate(ios_base::badbit);
1310 #ifndef _LIBCPP_NO_EXCEPTIONS
1314 this->__set_badbit_and_consider_rethrow();
1316 #endif // _LIBCPP_NO_EXCEPTIONS
1320 template<class _CharT, class _Traits>
1321 typename basic_istream<_CharT, _Traits>::pos_type
1322 basic_istream<_CharT, _Traits>::tellg()
1325 #ifndef _LIBCPP_NO_EXCEPTIONS
1328 #endif // _LIBCPP_NO_EXCEPTIONS
1329 sentry __sen(*this, true);
1331 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
1332 #ifndef _LIBCPP_NO_EXCEPTIONS
1336 this->__set_badbit_and_consider_rethrow();
1338 #endif // _LIBCPP_NO_EXCEPTIONS
1342 template<class _CharT, class _Traits>
1343 basic_istream<_CharT, _Traits>&
1344 basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
1346 #ifndef _LIBCPP_NO_EXCEPTIONS
1349 #endif // _LIBCPP_NO_EXCEPTIONS
1350 this->clear(this->rdstate() & ~ios_base::eofbit);
1351 sentry __sen(*this, true);
1354 if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
1355 this->setstate(ios_base::failbit);
1357 #ifndef _LIBCPP_NO_EXCEPTIONS
1361 this->__set_badbit_and_consider_rethrow();
1363 #endif // _LIBCPP_NO_EXCEPTIONS
1367 template<class _CharT, class _Traits>
1368 basic_istream<_CharT, _Traits>&
1369 basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
1371 #ifndef _LIBCPP_NO_EXCEPTIONS
1374 #endif // _LIBCPP_NO_EXCEPTIONS
1375 this->clear(this->rdstate() & ~ios_base::eofbit);
1376 sentry __sen(*this, true);
1379 if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
1380 this->setstate(ios_base::failbit);
1382 #ifndef _LIBCPP_NO_EXCEPTIONS
1386 this->__set_badbit_and_consider_rethrow();
1388 #endif // _LIBCPP_NO_EXCEPTIONS
1392 template <class _CharT, class _Traits>
1393 basic_istream<_CharT, _Traits>&
1394 ws(basic_istream<_CharT, _Traits>& __is)
1396 #ifndef _LIBCPP_NO_EXCEPTIONS
1399 #endif // _LIBCPP_NO_EXCEPTIONS
1400 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1403 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1406 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1407 if (_Traits::eq_int_type(__i, _Traits::eof()))
1409 __is.setstate(ios_base::eofbit);
1412 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
1414 __is.rdbuf()->sbumpc();
1417 #ifndef _LIBCPP_NO_EXCEPTIONS
1421 __is.__set_badbit_and_consider_rethrow();
1423 #endif // _LIBCPP_NO_EXCEPTIONS
1427 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1429 template <class _CharT, class _Traits, class _Tp>
1430 inline _LIBCPP_INLINE_VISIBILITY
1431 basic_istream<_CharT, _Traits>&
1432 operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
1434 __is >> _VSTD::forward<_Tp>(__x);
1438 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1440 template <class _CharT, class _Traits>
1441 class _LIBCPP_TEMPLATE_VIS basic_iostream
1442 : public basic_istream<_CharT, _Traits>,
1443 public basic_ostream<_CharT, _Traits>
1447 typedef _CharT char_type;
1448 typedef _Traits traits_type;
1449 typedef typename traits_type::int_type int_type;
1450 typedef typename traits_type::pos_type pos_type;
1451 typedef typename traits_type::off_type off_type;
1453 // constructor/destructor
1454 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
1455 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
1456 : basic_istream<_CharT, _Traits>(__sb)
1459 virtual ~basic_iostream();
1461 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1462 inline _LIBCPP_INLINE_VISIBILITY
1463 basic_iostream(basic_iostream&& __rhs);
1467 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1468 inline _LIBCPP_INLINE_VISIBILITY
1469 basic_iostream& operator=(basic_iostream&& __rhs);
1471 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
1472 void swap(basic_iostream& __rhs)
1473 { basic_istream<char_type, traits_type>::swap(__rhs); }
1477 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1479 template <class _CharT, class _Traits>
1480 basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
1481 : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
1485 template <class _CharT, class _Traits>
1486 basic_iostream<_CharT, _Traits>&
1487 basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
1493 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1495 template <class _CharT, class _Traits>
1496 basic_iostream<_CharT, _Traits>::~basic_iostream()
1500 template<class _CharT, class _Traits, class _Allocator>
1501 basic_istream<_CharT, _Traits>&
1502 operator>>(basic_istream<_CharT, _Traits>& __is,
1503 basic_string<_CharT, _Traits, _Allocator>& __str)
1505 #ifndef _LIBCPP_NO_EXCEPTIONS
1508 #endif // _LIBCPP_NO_EXCEPTIONS
1509 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1513 streamsize __n = __is.width();
1515 __n = __str.max_size();
1517 __n = numeric_limits<streamsize>::max();
1519 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1520 ios_base::iostate __err = ios_base::goodbit;
1523 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1524 if (_Traits::eq_int_type(__i, _Traits::eof()))
1526 __err |= ios_base::eofbit;
1529 _CharT __ch = _Traits::to_char_type(__i);
1530 if (__ct.is(__ct.space, __ch))
1532 __str.push_back(__ch);
1534 __is.rdbuf()->sbumpc();
1538 __err |= ios_base::failbit;
1539 __is.setstate(__err);
1542 __is.setstate(ios_base::failbit);
1543 #ifndef _LIBCPP_NO_EXCEPTIONS
1547 __is.__set_badbit_and_consider_rethrow();
1549 #endif // _LIBCPP_NO_EXCEPTIONS
1553 template<class _CharT, class _Traits, class _Allocator>
1554 basic_istream<_CharT, _Traits>&
1555 getline(basic_istream<_CharT, _Traits>& __is,
1556 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1558 #ifndef _LIBCPP_NO_EXCEPTIONS
1561 #endif // _LIBCPP_NO_EXCEPTIONS
1562 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1566 ios_base::iostate __err = ios_base::goodbit;
1567 streamsize __extr = 0;
1570 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
1571 if (_Traits::eq_int_type(__i, _Traits::eof()))
1573 __err |= ios_base::eofbit;
1577 _CharT __ch = _Traits::to_char_type(__i);
1578 if (_Traits::eq(__ch, __dlm))
1580 __str.push_back(__ch);
1581 if (__str.size() == __str.max_size())
1583 __err |= ios_base::failbit;
1588 __err |= ios_base::failbit;
1589 __is.setstate(__err);
1591 #ifndef _LIBCPP_NO_EXCEPTIONS
1595 __is.__set_badbit_and_consider_rethrow();
1597 #endif // _LIBCPP_NO_EXCEPTIONS
1601 template<class _CharT, class _Traits, class _Allocator>
1602 inline _LIBCPP_INLINE_VISIBILITY
1603 basic_istream<_CharT, _Traits>&
1604 getline(basic_istream<_CharT, _Traits>& __is,
1605 basic_string<_CharT, _Traits, _Allocator>& __str)
1607 return getline(__is, __str, __is.widen('\n'));
1610 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1612 template<class _CharT, class _Traits, class _Allocator>
1613 inline _LIBCPP_INLINE_VISIBILITY
1614 basic_istream<_CharT, _Traits>&
1615 getline(basic_istream<_CharT, _Traits>&& __is,
1616 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1618 return getline(__is, __str, __dlm);
1621 template<class _CharT, class _Traits, class _Allocator>
1622 inline _LIBCPP_INLINE_VISIBILITY
1623 basic_istream<_CharT, _Traits>&
1624 getline(basic_istream<_CharT, _Traits>&& __is,
1625 basic_string<_CharT, _Traits, _Allocator>& __str)
1627 return getline(__is, __str, __is.widen('\n'));
1630 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1632 template <class _CharT, class _Traits, size_t _Size>
1633 basic_istream<_CharT, _Traits>&
1634 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1636 #ifndef _LIBCPP_NO_EXCEPTIONS
1639 #endif // _LIBCPP_NO_EXCEPTIONS
1640 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1643 basic_string<_CharT, _Traits> __str;
1644 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1646 ios_base::iostate __err = ios_base::goodbit;
1647 _CharT __zero = __ct.widen('0');
1648 _CharT __one = __ct.widen('1');
1651 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1652 if (_Traits::eq_int_type(__i, _Traits::eof()))
1654 __err |= ios_base::eofbit;
1657 _CharT __ch = _Traits::to_char_type(__i);
1658 if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
1660 __str.push_back(__ch);
1662 __is.rdbuf()->sbumpc();
1664 __x = bitset<_Size>(__str);
1666 __err |= ios_base::failbit;
1667 __is.setstate(__err);
1670 __is.setstate(ios_base::failbit);
1671 #ifndef _LIBCPP_NO_EXCEPTIONS
1675 __is.__set_badbit_and_consider_rethrow();
1677 #endif // _LIBCPP_NO_EXCEPTIONS
1681 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>)
1682 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>)
1683 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>)
1685 _LIBCPP_END_NAMESPACE_STD
1687 #endif // _LIBCPP_ISTREAM