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 #if _LIBCPP_STD_VER > 11
209 #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
210 basic_istream (const basic_istream& __rhs) = delete;
211 basic_istream& operator=(const basic_istream& __rhs) = delete;
213 basic_istream (const basic_istream& __rhs); // not defined
214 basic_istream& operator=(const basic_istream& __rhs); // not defined
219 // 27.7.1.1.3 Prefix/suffix:
220 class _LIBCPP_TEMPLATE_VIS sentry;
222 // 27.7.1.2 Formatted input:
223 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
224 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&))
225 { return __pf(*this); }
227 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
228 basic_istream& operator>>(basic_ios<char_type, traits_type>&
229 (*__pf)(basic_ios<char_type, traits_type>&))
230 { __pf(*this); return *this; }
232 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
233 basic_istream& operator>>(ios_base& (*__pf)(ios_base&))
234 { __pf(*this); return *this; }
236 basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
237 basic_istream& operator>>(bool& __n);
238 basic_istream& operator>>(short& __n);
239 basic_istream& operator>>(unsigned short& __n);
240 basic_istream& operator>>(int& __n);
241 basic_istream& operator>>(unsigned int& __n);
242 basic_istream& operator>>(long& __n);
243 basic_istream& operator>>(unsigned long& __n);
244 basic_istream& operator>>(long long& __n);
245 basic_istream& operator>>(unsigned long long& __n);
246 basic_istream& operator>>(float& __f);
247 basic_istream& operator>>(double& __f);
248 basic_istream& operator>>(long double& __f);
249 basic_istream& operator>>(void*& __p);
251 // 27.7.1.3 Unformatted input:
252 _LIBCPP_INLINE_VISIBILITY
253 streamsize gcount() const {return __gc_;}
256 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
257 basic_istream& get(char_type& __c) {
258 int_type __ch = get();
259 if (__ch != traits_type::eof())
260 __c = traits_type::to_char_type(__ch);
264 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
265 basic_istream& get(char_type* __s, streamsize __n)
266 { return get(__s, __n, this->widen('\n')); }
268 basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
270 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
271 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb)
272 { return get(__sb, this->widen('\n')); }
274 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
276 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
277 basic_istream& getline(char_type* __s, streamsize __n)
278 { return getline(__s, __n, this->widen('\n')); }
280 basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
282 basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
284 basic_istream& read (char_type* __s, streamsize __n);
285 streamsize readsome(char_type* __s, streamsize __n);
287 basic_istream& putback(char_type __c);
288 basic_istream& unget();
292 basic_istream& seekg(pos_type __pos);
293 basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
296 template <class _CharT, class _Traits>
297 class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry
301 sentry(const sentry&); // = delete;
302 sentry& operator=(const sentry&); // = delete;
305 explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
306 // ~sentry() = default;
308 _LIBCPP_INLINE_VISIBILITY
310 operator bool() const {return __ok_;}
313 template <class _CharT, class _Traits>
314 basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is,
322 if (!__noskipws && (__is.flags() & ios_base::skipws))
324 typedef istreambuf_iterator<_CharT, _Traits> _Ip;
325 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
328 for (; __i != __eof; ++__i)
329 if (!__ct.is(__ct.space, *__i))
332 __is.setstate(ios_base::failbit | ios_base::eofbit);
337 __is.setstate(ios_base::failbit);
340 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
342 template <class _CharT, class _Traits>
343 basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
350 template <class _CharT, class _Traits>
351 basic_istream<_CharT, _Traits>&
352 basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
358 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
360 template <class _CharT, class _Traits>
361 basic_istream<_CharT, _Traits>::~basic_istream()
365 template <class _CharT, class _Traits>
366 basic_istream<_CharT, _Traits>&
367 basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
369 #ifndef _LIBCPP_NO_EXCEPTIONS
372 #endif // _LIBCPP_NO_EXCEPTIONS
376 typedef istreambuf_iterator<char_type, traits_type> _Ip;
377 typedef num_get<char_type, _Ip> _Fp;
378 ios_base::iostate __err = ios_base::goodbit;
379 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
380 this->setstate(__err);
382 #ifndef _LIBCPP_NO_EXCEPTIONS
386 this->__set_badbit_and_consider_rethrow();
388 #endif // _LIBCPP_NO_EXCEPTIONS
392 template <class _CharT, class _Traits>
393 basic_istream<_CharT, _Traits>&
394 basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
396 #ifndef _LIBCPP_NO_EXCEPTIONS
399 #endif // _LIBCPP_NO_EXCEPTIONS
403 typedef istreambuf_iterator<char_type, traits_type> _Ip;
404 typedef num_get<char_type, _Ip> _Fp;
405 ios_base::iostate __err = ios_base::goodbit;
406 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
407 this->setstate(__err);
409 #ifndef _LIBCPP_NO_EXCEPTIONS
413 this->__set_badbit_and_consider_rethrow();
415 #endif // _LIBCPP_NO_EXCEPTIONS
419 template <class _CharT, class _Traits>
420 basic_istream<_CharT, _Traits>&
421 basic_istream<_CharT, _Traits>::operator>>(long& __n)
423 #ifndef _LIBCPP_NO_EXCEPTIONS
426 #endif // _LIBCPP_NO_EXCEPTIONS
430 typedef istreambuf_iterator<char_type, traits_type> _Ip;
431 typedef num_get<char_type, _Ip> _Fp;
432 ios_base::iostate __err = ios_base::goodbit;
433 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
434 this->setstate(__err);
436 #ifndef _LIBCPP_NO_EXCEPTIONS
440 this->__set_badbit_and_consider_rethrow();
442 #endif // _LIBCPP_NO_EXCEPTIONS
446 template <class _CharT, class _Traits>
447 basic_istream<_CharT, _Traits>&
448 basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
450 #ifndef _LIBCPP_NO_EXCEPTIONS
453 #endif // _LIBCPP_NO_EXCEPTIONS
457 typedef istreambuf_iterator<char_type, traits_type> _Ip;
458 typedef num_get<char_type, _Ip> _Fp;
459 ios_base::iostate __err = ios_base::goodbit;
460 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
461 this->setstate(__err);
463 #ifndef _LIBCPP_NO_EXCEPTIONS
467 this->__set_badbit_and_consider_rethrow();
469 #endif // _LIBCPP_NO_EXCEPTIONS
473 template <class _CharT, class _Traits>
474 basic_istream<_CharT, _Traits>&
475 basic_istream<_CharT, _Traits>::operator>>(long long& __n)
477 #ifndef _LIBCPP_NO_EXCEPTIONS
480 #endif // _LIBCPP_NO_EXCEPTIONS
484 typedef istreambuf_iterator<char_type, traits_type> _Ip;
485 typedef num_get<char_type, _Ip> _Fp;
486 ios_base::iostate __err = ios_base::goodbit;
487 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
488 this->setstate(__err);
490 #ifndef _LIBCPP_NO_EXCEPTIONS
494 this->__set_badbit_and_consider_rethrow();
496 #endif // _LIBCPP_NO_EXCEPTIONS
500 template <class _CharT, class _Traits>
501 basic_istream<_CharT, _Traits>&
502 basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
504 #ifndef _LIBCPP_NO_EXCEPTIONS
507 #endif // _LIBCPP_NO_EXCEPTIONS
511 typedef istreambuf_iterator<char_type, traits_type> _Ip;
512 typedef num_get<char_type, _Ip> _Fp;
513 ios_base::iostate __err = ios_base::goodbit;
514 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
515 this->setstate(__err);
517 #ifndef _LIBCPP_NO_EXCEPTIONS
521 this->__set_badbit_and_consider_rethrow();
523 #endif // _LIBCPP_NO_EXCEPTIONS
527 template <class _CharT, class _Traits>
528 basic_istream<_CharT, _Traits>&
529 basic_istream<_CharT, _Traits>::operator>>(float& __n)
531 #ifndef _LIBCPP_NO_EXCEPTIONS
534 #endif // _LIBCPP_NO_EXCEPTIONS
538 typedef istreambuf_iterator<char_type, traits_type> _Ip;
539 typedef num_get<char_type, _Ip> _Fp;
540 ios_base::iostate __err = ios_base::goodbit;
541 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
542 this->setstate(__err);
544 #ifndef _LIBCPP_NO_EXCEPTIONS
548 this->__set_badbit_and_consider_rethrow();
550 #endif // _LIBCPP_NO_EXCEPTIONS
554 template <class _CharT, class _Traits>
555 basic_istream<_CharT, _Traits>&
556 basic_istream<_CharT, _Traits>::operator>>(double& __n)
558 #ifndef _LIBCPP_NO_EXCEPTIONS
561 #endif // _LIBCPP_NO_EXCEPTIONS
565 typedef istreambuf_iterator<char_type, traits_type> _Ip;
566 typedef num_get<char_type, _Ip> _Fp;
567 ios_base::iostate __err = ios_base::goodbit;
568 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
569 this->setstate(__err);
571 #ifndef _LIBCPP_NO_EXCEPTIONS
575 this->__set_badbit_and_consider_rethrow();
577 #endif // _LIBCPP_NO_EXCEPTIONS
581 template <class _CharT, class _Traits>
582 basic_istream<_CharT, _Traits>&
583 basic_istream<_CharT, _Traits>::operator>>(long double& __n)
585 #ifndef _LIBCPP_NO_EXCEPTIONS
588 #endif // _LIBCPP_NO_EXCEPTIONS
592 typedef istreambuf_iterator<char_type, traits_type> _Ip;
593 typedef num_get<char_type, _Ip> _Fp;
594 ios_base::iostate __err = ios_base::goodbit;
595 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
596 this->setstate(__err);
598 #ifndef _LIBCPP_NO_EXCEPTIONS
602 this->__set_badbit_and_consider_rethrow();
604 #endif // _LIBCPP_NO_EXCEPTIONS
608 template <class _CharT, class _Traits>
609 basic_istream<_CharT, _Traits>&
610 basic_istream<_CharT, _Traits>::operator>>(bool& __n)
612 #ifndef _LIBCPP_NO_EXCEPTIONS
615 #endif // _LIBCPP_NO_EXCEPTIONS
619 typedef istreambuf_iterator<char_type, traits_type> _Ip;
620 typedef num_get<char_type, _Ip> _Fp;
621 ios_base::iostate __err = ios_base::goodbit;
622 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
623 this->setstate(__err);
625 #ifndef _LIBCPP_NO_EXCEPTIONS
629 this->__set_badbit_and_consider_rethrow();
631 #endif // _LIBCPP_NO_EXCEPTIONS
635 template <class _CharT, class _Traits>
636 basic_istream<_CharT, _Traits>&
637 basic_istream<_CharT, _Traits>::operator>>(void*& __n)
639 #ifndef _LIBCPP_NO_EXCEPTIONS
642 #endif // _LIBCPP_NO_EXCEPTIONS
646 typedef istreambuf_iterator<char_type, traits_type> _Ip;
647 typedef num_get<char_type, _Ip> _Fp;
648 ios_base::iostate __err = ios_base::goodbit;
649 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
650 this->setstate(__err);
652 #ifndef _LIBCPP_NO_EXCEPTIONS
656 this->__set_badbit_and_consider_rethrow();
658 #endif // _LIBCPP_NO_EXCEPTIONS
662 template <class _CharT, class _Traits>
663 basic_istream<_CharT, _Traits>&
664 basic_istream<_CharT, _Traits>::operator>>(short& __n)
666 #ifndef _LIBCPP_NO_EXCEPTIONS
669 #endif // _LIBCPP_NO_EXCEPTIONS
673 typedef istreambuf_iterator<char_type, traits_type> _Ip;
674 typedef num_get<char_type, _Ip> _Fp;
675 ios_base::iostate __err = ios_base::goodbit;
677 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
678 if (__temp < numeric_limits<short>::min())
680 __err |= ios_base::failbit;
681 __n = numeric_limits<short>::min();
683 else if (__temp > numeric_limits<short>::max())
685 __err |= ios_base::failbit;
686 __n = numeric_limits<short>::max();
689 __n = static_cast<short>(__temp);
690 this->setstate(__err);
692 #ifndef _LIBCPP_NO_EXCEPTIONS
696 this->__set_badbit_and_consider_rethrow();
698 #endif // _LIBCPP_NO_EXCEPTIONS
702 template <class _CharT, class _Traits>
703 basic_istream<_CharT, _Traits>&
704 basic_istream<_CharT, _Traits>::operator>>(int& __n)
706 #ifndef _LIBCPP_NO_EXCEPTIONS
709 #endif // _LIBCPP_NO_EXCEPTIONS
713 typedef istreambuf_iterator<char_type, traits_type> _Ip;
714 typedef num_get<char_type, _Ip> _Fp;
715 ios_base::iostate __err = ios_base::goodbit;
717 use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
718 if (__temp < numeric_limits<int>::min())
720 __err |= ios_base::failbit;
721 __n = numeric_limits<int>::min();
723 else if (__temp > numeric_limits<int>::max())
725 __err |= ios_base::failbit;
726 __n = numeric_limits<int>::max();
729 __n = static_cast<int>(__temp);
730 this->setstate(__err);
732 #ifndef _LIBCPP_NO_EXCEPTIONS
736 this->__set_badbit_and_consider_rethrow();
738 #endif // _LIBCPP_NO_EXCEPTIONS
742 template<class _CharT, class _Traits>
743 basic_istream<_CharT, _Traits>&
744 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
746 #ifndef _LIBCPP_NO_EXCEPTIONS
749 #endif // _LIBCPP_NO_EXCEPTIONS
750 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
753 streamsize __n = __is.width();
755 __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
757 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
758 ios_base::iostate __err = ios_base::goodbit;
761 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
762 if (_Traits::eq_int_type(__i, _Traits::eof()))
764 __err |= ios_base::eofbit;
767 _CharT __ch = _Traits::to_char_type(__i);
768 if (__ct.is(__ct.space, __ch))
772 __is.rdbuf()->sbumpc();
777 __err |= ios_base::failbit;
778 __is.setstate(__err);
780 #ifndef _LIBCPP_NO_EXCEPTIONS
784 __is.__set_badbit_and_consider_rethrow();
786 #endif // _LIBCPP_NO_EXCEPTIONS
790 template<class _Traits>
791 inline _LIBCPP_INLINE_VISIBILITY
792 basic_istream<char, _Traits>&
793 operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
795 return __is >> (char*)__s;
798 template<class _Traits>
799 inline _LIBCPP_INLINE_VISIBILITY
800 basic_istream<char, _Traits>&
801 operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
803 return __is >> (char*)__s;
806 template<class _CharT, class _Traits>
807 basic_istream<_CharT, _Traits>&
808 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
810 #ifndef _LIBCPP_NO_EXCEPTIONS
813 #endif // _LIBCPP_NO_EXCEPTIONS
814 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
817 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
818 if (_Traits::eq_int_type(__i, _Traits::eof()))
819 __is.setstate(ios_base::eofbit | ios_base::failbit);
821 __c = _Traits::to_char_type(__i);
823 #ifndef _LIBCPP_NO_EXCEPTIONS
827 __is.__set_badbit_and_consider_rethrow();
829 #endif // _LIBCPP_NO_EXCEPTIONS
833 template<class _Traits>
834 inline _LIBCPP_INLINE_VISIBILITY
835 basic_istream<char, _Traits>&
836 operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
838 return __is >> (char&)__c;
841 template<class _Traits>
842 inline _LIBCPP_INLINE_VISIBILITY
843 basic_istream<char, _Traits>&
844 operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
846 return __is >> (char&)__c;
849 template<class _CharT, class _Traits>
850 basic_istream<_CharT, _Traits>&
851 basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
854 #ifndef _LIBCPP_NO_EXCEPTIONS
857 #endif // _LIBCPP_NO_EXCEPTIONS
858 sentry __s(*this, true);
863 #ifndef _LIBCPP_NO_EXCEPTIONS
866 #endif // _LIBCPP_NO_EXCEPTIONS
867 ios_base::iostate __err = ios_base::goodbit;
870 typename traits_type::int_type __i = this->rdbuf()->sgetc();
871 if (traits_type::eq_int_type(__i, _Traits::eof()))
873 __err |= ios_base::eofbit;
876 if (traits_type::eq_int_type(
877 __sb->sputc(traits_type::to_char_type(__i)),
881 this->rdbuf()->sbumpc();
884 __err |= ios_base::failbit;
885 this->setstate(__err);
886 #ifndef _LIBCPP_NO_EXCEPTIONS
891 this->__set_failbit_and_consider_rethrow();
893 #endif // _LIBCPP_NO_EXCEPTIONS
896 this->setstate(ios_base::failbit);
898 #ifndef _LIBCPP_NO_EXCEPTIONS
902 this->__set_badbit_and_consider_rethrow();
904 #endif // _LIBCPP_NO_EXCEPTIONS
908 template<class _CharT, class _Traits>
909 typename basic_istream<_CharT, _Traits>::int_type
910 basic_istream<_CharT, _Traits>::get()
913 int_type __r = traits_type::eof();
914 #ifndef _LIBCPP_NO_EXCEPTIONS
917 #endif // _LIBCPP_NO_EXCEPTIONS
918 sentry __s(*this, true);
921 __r = this->rdbuf()->sbumpc();
922 if (traits_type::eq_int_type(__r, traits_type::eof()))
923 this->setstate(ios_base::failbit | ios_base::eofbit);
927 #ifndef _LIBCPP_NO_EXCEPTIONS
931 this->__set_badbit_and_consider_rethrow();
933 #endif // _LIBCPP_NO_EXCEPTIONS
937 template<class _CharT, class _Traits>
938 basic_istream<_CharT, _Traits>&
939 basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
942 #ifndef _LIBCPP_NO_EXCEPTIONS
945 #endif // _LIBCPP_NO_EXCEPTIONS
946 sentry __sen(*this, true);
951 ios_base::iostate __err = ios_base::goodbit;
952 while (__gc_ < __n-1)
954 int_type __i = this->rdbuf()->sgetc();
955 if (traits_type::eq_int_type(__i, traits_type::eof()))
957 __err |= ios_base::eofbit;
960 char_type __ch = traits_type::to_char_type(__i);
961 if (traits_type::eq(__ch, __dlm))
965 this->rdbuf()->sbumpc();
969 __err |= ios_base::failbit;
970 this->setstate(__err);
973 this->setstate(ios_base::failbit);
975 #ifndef _LIBCPP_NO_EXCEPTIONS
979 this->__set_badbit_and_consider_rethrow();
981 #endif // _LIBCPP_NO_EXCEPTIONS
985 template<class _CharT, class _Traits>
986 basic_istream<_CharT, _Traits>&
987 basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
991 #ifndef _LIBCPP_NO_EXCEPTIONS
994 #endif // _LIBCPP_NO_EXCEPTIONS
995 sentry __sen(*this, true);
998 ios_base::iostate __err = ios_base::goodbit;
999 #ifndef _LIBCPP_NO_EXCEPTIONS
1002 #endif // _LIBCPP_NO_EXCEPTIONS
1005 typename traits_type::int_type __i = this->rdbuf()->sgetc();
1006 if (traits_type::eq_int_type(__i, traits_type::eof()))
1008 __err |= ios_base::eofbit;
1011 char_type __ch = traits_type::to_char_type(__i);
1012 if (traits_type::eq(__ch, __dlm))
1014 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
1017 this->rdbuf()->sbumpc();
1019 #ifndef _LIBCPP_NO_EXCEPTIONS
1024 #endif // _LIBCPP_NO_EXCEPTIONS
1026 __err |= ios_base::failbit;
1027 this->setstate(__err);
1029 #ifndef _LIBCPP_NO_EXCEPTIONS
1033 this->__set_badbit_and_consider_rethrow();
1035 #endif // _LIBCPP_NO_EXCEPTIONS
1039 template<class _CharT, class _Traits>
1040 basic_istream<_CharT, _Traits>&
1041 basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
1044 #ifndef _LIBCPP_NO_EXCEPTIONS
1047 #endif // _LIBCPP_NO_EXCEPTIONS
1048 sentry __sen(*this, true);
1051 ios_base::iostate __err = ios_base::goodbit;
1054 typename traits_type::int_type __i = this->rdbuf()->sgetc();
1055 if (traits_type::eq_int_type(__i, traits_type::eof()))
1057 __err |= ios_base::eofbit;
1060 char_type __ch = traits_type::to_char_type(__i);
1061 if (traits_type::eq(__ch, __dlm))
1063 this->rdbuf()->sbumpc();
1069 __err |= ios_base::failbit;
1073 this->rdbuf()->sbumpc();
1079 __err |= ios_base::failbit;
1080 this->setstate(__err);
1082 #ifndef _LIBCPP_NO_EXCEPTIONS
1086 this->__set_badbit_and_consider_rethrow();
1088 #endif // _LIBCPP_NO_EXCEPTIONS
1092 template<class _CharT, class _Traits>
1093 basic_istream<_CharT, _Traits>&
1094 basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
1097 #ifndef _LIBCPP_NO_EXCEPTIONS
1100 #endif // _LIBCPP_NO_EXCEPTIONS
1101 sentry __sen(*this, true);
1104 ios_base::iostate __err = ios_base::goodbit;
1105 if (__n == numeric_limits<streamsize>::max())
1109 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1110 if (traits_type::eq_int_type(__i, traits_type::eof()))
1112 __err |= ios_base::eofbit;
1116 if (traits_type::eq_int_type(__i, __dlm))
1124 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
1125 if (traits_type::eq_int_type(__i, traits_type::eof()))
1127 __err |= ios_base::eofbit;
1131 if (traits_type::eq_int_type(__i, __dlm))
1135 this->setstate(__err);
1137 #ifndef _LIBCPP_NO_EXCEPTIONS
1141 this->__set_badbit_and_consider_rethrow();
1143 #endif // _LIBCPP_NO_EXCEPTIONS
1147 template<class _CharT, class _Traits>
1148 typename basic_istream<_CharT, _Traits>::int_type
1149 basic_istream<_CharT, _Traits>::peek()
1152 int_type __r = traits_type::eof();
1153 #ifndef _LIBCPP_NO_EXCEPTIONS
1156 #endif // _LIBCPP_NO_EXCEPTIONS
1157 sentry __sen(*this, true);
1160 __r = this->rdbuf()->sgetc();
1161 if (traits_type::eq_int_type(__r, traits_type::eof()))
1162 this->setstate(ios_base::eofbit);
1164 #ifndef _LIBCPP_NO_EXCEPTIONS
1168 this->__set_badbit_and_consider_rethrow();
1170 #endif // _LIBCPP_NO_EXCEPTIONS
1174 template<class _CharT, class _Traits>
1175 basic_istream<_CharT, _Traits>&
1176 basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
1179 #ifndef _LIBCPP_NO_EXCEPTIONS
1182 #endif // _LIBCPP_NO_EXCEPTIONS
1183 sentry __sen(*this, true);
1186 __gc_ = this->rdbuf()->sgetn(__s, __n);
1188 this->setstate(ios_base::failbit | ios_base::eofbit);
1191 this->setstate(ios_base::failbit);
1192 #ifndef _LIBCPP_NO_EXCEPTIONS
1196 this->__set_badbit_and_consider_rethrow();
1198 #endif // _LIBCPP_NO_EXCEPTIONS
1202 template<class _CharT, class _Traits>
1204 basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
1207 #ifndef _LIBCPP_NO_EXCEPTIONS
1210 #endif // _LIBCPP_NO_EXCEPTIONS
1211 sentry __sen(*this, true);
1214 streamsize __c = this->rdbuf()->in_avail();
1218 this->setstate(ios_base::eofbit);
1223 read(__s, _VSTD::min(__c, __n));
1228 this->setstate(ios_base::failbit);
1229 #ifndef _LIBCPP_NO_EXCEPTIONS
1233 this->__set_badbit_and_consider_rethrow();
1235 #endif // _LIBCPP_NO_EXCEPTIONS
1239 template<class _CharT, class _Traits>
1240 basic_istream<_CharT, _Traits>&
1241 basic_istream<_CharT, _Traits>::putback(char_type __c)
1244 #ifndef _LIBCPP_NO_EXCEPTIONS
1247 #endif // _LIBCPP_NO_EXCEPTIONS
1248 this->clear(this->rdstate() & ~ios_base::eofbit);
1249 sentry __sen(*this, true);
1252 if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
1253 this->setstate(ios_base::badbit);
1256 this->setstate(ios_base::failbit);
1257 #ifndef _LIBCPP_NO_EXCEPTIONS
1261 this->__set_badbit_and_consider_rethrow();
1263 #endif // _LIBCPP_NO_EXCEPTIONS
1267 template<class _CharT, class _Traits>
1268 basic_istream<_CharT, _Traits>&
1269 basic_istream<_CharT, _Traits>::unget()
1272 #ifndef _LIBCPP_NO_EXCEPTIONS
1275 #endif // _LIBCPP_NO_EXCEPTIONS
1276 this->clear(this->rdstate() & ~ios_base::eofbit);
1277 sentry __sen(*this, true);
1280 if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
1281 this->setstate(ios_base::badbit);
1284 this->setstate(ios_base::failbit);
1285 #ifndef _LIBCPP_NO_EXCEPTIONS
1289 this->__set_badbit_and_consider_rethrow();
1291 #endif // _LIBCPP_NO_EXCEPTIONS
1295 template<class _CharT, class _Traits>
1297 basic_istream<_CharT, _Traits>::sync()
1300 #ifndef _LIBCPP_NO_EXCEPTIONS
1303 #endif // _LIBCPP_NO_EXCEPTIONS
1304 sentry __sen(*this, true);
1307 if (this->rdbuf() == 0)
1309 if (this->rdbuf()->pubsync() == -1)
1311 this->setstate(ios_base::badbit);
1315 #ifndef _LIBCPP_NO_EXCEPTIONS
1319 this->__set_badbit_and_consider_rethrow();
1321 #endif // _LIBCPP_NO_EXCEPTIONS
1325 template<class _CharT, class _Traits>
1326 typename basic_istream<_CharT, _Traits>::pos_type
1327 basic_istream<_CharT, _Traits>::tellg()
1330 #ifndef _LIBCPP_NO_EXCEPTIONS
1333 #endif // _LIBCPP_NO_EXCEPTIONS
1334 sentry __sen(*this, true);
1336 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
1337 #ifndef _LIBCPP_NO_EXCEPTIONS
1341 this->__set_badbit_and_consider_rethrow();
1343 #endif // _LIBCPP_NO_EXCEPTIONS
1347 template<class _CharT, class _Traits>
1348 basic_istream<_CharT, _Traits>&
1349 basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
1351 #ifndef _LIBCPP_NO_EXCEPTIONS
1354 #endif // _LIBCPP_NO_EXCEPTIONS
1355 this->clear(this->rdstate() & ~ios_base::eofbit);
1356 sentry __sen(*this, true);
1359 if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
1360 this->setstate(ios_base::failbit);
1362 #ifndef _LIBCPP_NO_EXCEPTIONS
1366 this->__set_badbit_and_consider_rethrow();
1368 #endif // _LIBCPP_NO_EXCEPTIONS
1372 template<class _CharT, class _Traits>
1373 basic_istream<_CharT, _Traits>&
1374 basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
1376 #ifndef _LIBCPP_NO_EXCEPTIONS
1379 #endif // _LIBCPP_NO_EXCEPTIONS
1380 this->clear(this->rdstate() & ~ios_base::eofbit);
1381 sentry __sen(*this, true);
1384 if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
1385 this->setstate(ios_base::failbit);
1387 #ifndef _LIBCPP_NO_EXCEPTIONS
1391 this->__set_badbit_and_consider_rethrow();
1393 #endif // _LIBCPP_NO_EXCEPTIONS
1397 template <class _CharT, class _Traits>
1398 basic_istream<_CharT, _Traits>&
1399 ws(basic_istream<_CharT, _Traits>& __is)
1401 #ifndef _LIBCPP_NO_EXCEPTIONS
1404 #endif // _LIBCPP_NO_EXCEPTIONS
1405 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1408 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1411 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1412 if (_Traits::eq_int_type(__i, _Traits::eof()))
1414 __is.setstate(ios_base::eofbit);
1417 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
1419 __is.rdbuf()->sbumpc();
1422 #ifndef _LIBCPP_NO_EXCEPTIONS
1426 __is.__set_badbit_and_consider_rethrow();
1428 #endif // _LIBCPP_NO_EXCEPTIONS
1432 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1434 template <class _CharT, class _Traits, class _Tp>
1435 inline _LIBCPP_INLINE_VISIBILITY
1436 basic_istream<_CharT, _Traits>&
1437 operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
1439 __is >> _VSTD::forward<_Tp>(__x);
1443 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1445 template <class _CharT, class _Traits>
1446 class _LIBCPP_TEMPLATE_VIS basic_iostream
1447 : public basic_istream<_CharT, _Traits>,
1448 public basic_ostream<_CharT, _Traits>
1452 typedef _CharT char_type;
1453 typedef _Traits traits_type;
1454 typedef typename traits_type::int_type int_type;
1455 typedef typename traits_type::pos_type pos_type;
1456 typedef typename traits_type::off_type off_type;
1458 // constructor/destructor
1459 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
1460 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
1461 : basic_istream<_CharT, _Traits>(__sb)
1464 virtual ~basic_iostream();
1466 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1467 inline _LIBCPP_INLINE_VISIBILITY
1468 basic_iostream(basic_iostream&& __rhs);
1472 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1473 inline _LIBCPP_INLINE_VISIBILITY
1474 basic_iostream& operator=(basic_iostream&& __rhs);
1476 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
1477 void swap(basic_iostream& __rhs)
1478 { basic_istream<char_type, traits_type>::swap(__rhs); }
1482 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1484 template <class _CharT, class _Traits>
1485 basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
1486 : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
1490 template <class _CharT, class _Traits>
1491 basic_iostream<_CharT, _Traits>&
1492 basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
1498 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1500 template <class _CharT, class _Traits>
1501 basic_iostream<_CharT, _Traits>::~basic_iostream()
1505 template<class _CharT, class _Traits, class _Allocator>
1506 basic_istream<_CharT, _Traits>&
1507 operator>>(basic_istream<_CharT, _Traits>& __is,
1508 basic_string<_CharT, _Traits, _Allocator>& __str)
1510 #ifndef _LIBCPP_NO_EXCEPTIONS
1513 #endif // _LIBCPP_NO_EXCEPTIONS
1514 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1518 streamsize __n = __is.width();
1520 __n = __str.max_size();
1522 __n = numeric_limits<streamsize>::max();
1524 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1525 ios_base::iostate __err = ios_base::goodbit;
1528 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1529 if (_Traits::eq_int_type(__i, _Traits::eof()))
1531 __err |= ios_base::eofbit;
1534 _CharT __ch = _Traits::to_char_type(__i);
1535 if (__ct.is(__ct.space, __ch))
1537 __str.push_back(__ch);
1539 __is.rdbuf()->sbumpc();
1543 __err |= ios_base::failbit;
1544 __is.setstate(__err);
1547 __is.setstate(ios_base::failbit);
1548 #ifndef _LIBCPP_NO_EXCEPTIONS
1552 __is.__set_badbit_and_consider_rethrow();
1554 #endif // _LIBCPP_NO_EXCEPTIONS
1558 template<class _CharT, class _Traits, class _Allocator>
1559 basic_istream<_CharT, _Traits>&
1560 getline(basic_istream<_CharT, _Traits>& __is,
1561 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1563 #ifndef _LIBCPP_NO_EXCEPTIONS
1566 #endif // _LIBCPP_NO_EXCEPTIONS
1567 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1571 ios_base::iostate __err = ios_base::goodbit;
1572 streamsize __extr = 0;
1575 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
1576 if (_Traits::eq_int_type(__i, _Traits::eof()))
1578 __err |= ios_base::eofbit;
1582 _CharT __ch = _Traits::to_char_type(__i);
1583 if (_Traits::eq(__ch, __dlm))
1585 __str.push_back(__ch);
1586 if (__str.size() == __str.max_size())
1588 __err |= ios_base::failbit;
1593 __err |= ios_base::failbit;
1594 __is.setstate(__err);
1596 #ifndef _LIBCPP_NO_EXCEPTIONS
1600 __is.__set_badbit_and_consider_rethrow();
1602 #endif // _LIBCPP_NO_EXCEPTIONS
1606 template<class _CharT, class _Traits, class _Allocator>
1607 inline _LIBCPP_INLINE_VISIBILITY
1608 basic_istream<_CharT, _Traits>&
1609 getline(basic_istream<_CharT, _Traits>& __is,
1610 basic_string<_CharT, _Traits, _Allocator>& __str)
1612 return getline(__is, __str, __is.widen('\n'));
1615 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1617 template<class _CharT, class _Traits, class _Allocator>
1618 inline _LIBCPP_INLINE_VISIBILITY
1619 basic_istream<_CharT, _Traits>&
1620 getline(basic_istream<_CharT, _Traits>&& __is,
1621 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1623 return getline(__is, __str, __dlm);
1626 template<class _CharT, class _Traits, class _Allocator>
1627 inline _LIBCPP_INLINE_VISIBILITY
1628 basic_istream<_CharT, _Traits>&
1629 getline(basic_istream<_CharT, _Traits>&& __is,
1630 basic_string<_CharT, _Traits, _Allocator>& __str)
1632 return getline(__is, __str, __is.widen('\n'));
1635 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1637 template <class _CharT, class _Traits, size_t _Size>
1638 basic_istream<_CharT, _Traits>&
1639 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1641 #ifndef _LIBCPP_NO_EXCEPTIONS
1644 #endif // _LIBCPP_NO_EXCEPTIONS
1645 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1648 basic_string<_CharT, _Traits> __str;
1649 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1651 ios_base::iostate __err = ios_base::goodbit;
1652 _CharT __zero = __ct.widen('0');
1653 _CharT __one = __ct.widen('1');
1656 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1657 if (_Traits::eq_int_type(__i, _Traits::eof()))
1659 __err |= ios_base::eofbit;
1662 _CharT __ch = _Traits::to_char_type(__i);
1663 if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
1665 __str.push_back(__ch);
1667 __is.rdbuf()->sbumpc();
1669 __x = bitset<_Size>(__str);
1671 __err |= ios_base::failbit;
1672 __is.setstate(__err);
1675 __is.setstate(ios_base::failbit);
1676 #ifndef _LIBCPP_NO_EXCEPTIONS
1680 __is.__set_badbit_and_consider_rethrow();
1682 #endif // _LIBCPP_NO_EXCEPTIONS
1686 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>)
1687 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>)
1688 _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>)
1690 _LIBCPP_END_NAMESPACE_STD
1692 #endif // _LIBCPP_ISTREAM