Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- istream ----------------------------------===// |
| 3 | // |
Howard Hinnant | c566dc3 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | ee11c31 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_ISTREAM |
| 12 | #define _LIBCPP_ISTREAM |
| 13 | |
| 14 | /* |
| 15 | istream synopsis |
| 16 | |
| 17 | template <class charT, class traits = char_traits<charT> > |
| 18 | class basic_istream |
| 19 | : virtual public basic_ios<charT,traits> |
| 20 | { |
| 21 | public: |
| 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; |
| 28 | |
| 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(); |
| 33 | |
| 34 | // 27.7.1.1.2 Assign/swap: |
| 35 | basic_istream& operator=(basic_istream&& rhs); |
| 36 | void swap(basic_istream& rhs); |
| 37 | |
| 38 | // 27.7.1.1.3 Prefix/suffix: |
| 39 | class sentry; |
| 40 | |
| 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); |
| 60 | |
| 61 | // 27.7.1.3 Unformatted input: |
| 62 | streamsize gcount() const; |
| 63 | int_type get(); |
| 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); |
| 69 | |
| 70 | basic_istream& getline(char_type* s, streamsize n); |
| 71 | basic_istream& getline(char_type* s, streamsize n, char_type delim); |
| 72 | |
| 73 | basic_istream& ignore(streamsize n = 1, int_type delim = traits_type::eof()); |
| 74 | int_type peek(); |
| 75 | basic_istream& read (char_type* s, streamsize n); |
| 76 | streamsize readsome(char_type* s, streamsize n); |
| 77 | |
| 78 | basic_istream& putback(char_type c); |
| 79 | basic_istream& unget(); |
| 80 | int sync(); |
| 81 | |
| 82 | pos_type tellg(); |
| 83 | basic_istream& seekg(pos_type); |
| 84 | basic_istream& seekg(off_type, ios_base::seekdir); |
Marshall Clow | 27d2987 | 2014-09-16 15:27:01 +0000 | [diff] [blame] | 85 | protected: |
| 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); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 92 | }; |
| 93 | |
| 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&); |
| 97 | |
| 98 | template<class traits> |
| 99 | basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char&); |
| 100 | |
| 101 | template<class traits> |
| 102 | basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char&); |
| 103 | |
| 104 | template<class charT, class traits> |
| 105 | basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT*); |
| 106 | |
| 107 | template<class traits> |
| 108 | basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char*); |
| 109 | |
| 110 | template<class traits> |
| 111 | basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char*); |
| 112 | |
| 113 | template <class charT, class traits> |
| 114 | void |
| 115 | swap(basic_istream<charT, traits>& x, basic_istream<charT, traits>& y); |
| 116 | |
| 117 | typedef basic_istream<char> istream; |
| 118 | typedef basic_istream<wchar_t> wistream; |
| 119 | |
| 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> |
| 124 | { |
| 125 | public: |
| 126 | // types: |
| 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; |
| 132 | |
| 133 | // constructor/destructor |
| 134 | explicit basic_iostream(basic_streambuf<char_type, traits_type>* sb); |
| 135 | basic_iostream(basic_iostream&& rhs); |
| 136 | virtual ~basic_iostream(); |
| 137 | |
| 138 | // assign/swap |
| 139 | basic_iostream& operator=(basic_iostream&& rhs); |
| 140 | void swap(basic_iostream& rhs); |
| 141 | }; |
| 142 | |
| 143 | template <class charT, class traits> |
| 144 | void |
| 145 | swap(basic_iostream<charT, traits>& x, basic_iostream<charT, traits>& y); |
| 146 | |
| 147 | typedef basic_iostream<char> iostream; |
| 148 | typedef basic_iostream<wchar_t> wiostream; |
| 149 | |
| 150 | template <class charT, class traits> |
| 151 | basic_istream<charT,traits>& |
| 152 | ws(basic_istream<charT,traits>& is); |
| 153 | |
| 154 | template <class charT, class traits, class T> |
| 155 | basic_istream<charT, traits>& |
| 156 | operator>>(basic_istream<charT, traits>&& is, T& x); |
| 157 | |
| 158 | } // std |
| 159 | |
| 160 | */ |
| 161 | |
| 162 | #include <__config> |
| 163 | #include <ostream> |
| 164 | |
Howard Hinnant | c5a5fbd | 2011-11-29 16:45:27 +0000 | [diff] [blame] | 165 | #include <__undef_min_max> |
| 166 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 167 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 168 | #pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 169 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 170 | |
| 171 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 172 | |
| 173 | template <class _CharT, class _Traits> |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 174 | class _LIBCPP_TEMPLATE_VIS basic_istream |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 175 | : virtual public basic_ios<_CharT, _Traits> |
| 176 | { |
| 177 | streamsize __gc_; |
| 178 | public: |
| 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; |
| 185 | |
| 186 | // 27.7.1.1.1 Constructor/destructor: |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 187 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 188 | explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb) : __gc_(0) |
| 189 | { this->init(__sb); } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 190 | virtual ~basic_istream(); |
| 191 | protected: |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 192 | #ifndef _LIBCPP_CXX03_LANG |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 193 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 194 | basic_istream(basic_istream&& __rhs); |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 195 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 196 | // 27.7.1.1.2 Assign/swap: |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 197 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 198 | basic_istream& operator=(basic_istream&& __rhs); |
| 199 | #endif |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 200 | |
| 201 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 202 | void swap(basic_istream& __rhs) { |
| 203 | _VSTD::swap(__gc_, __rhs.__gc_); |
| 204 | basic_ios<char_type, traits_type>::swap(__rhs); |
| 205 | } |
Marshall Clow | 27d2987 | 2014-09-16 15:27:01 +0000 | [diff] [blame] | 206 | |
Eric Fiselier | 2d8515f | 2017-01-06 20:58:25 +0000 | [diff] [blame] | 207 | #ifndef _LIBCPP_CXX03_LANG |
Marshall Clow | 242d9c1 | 2014-09-16 15:33:53 +0000 | [diff] [blame] | 208 | basic_istream (const basic_istream& __rhs) = delete; |
| 209 | basic_istream& operator=(const basic_istream& __rhs) = delete; |
Marshall Clow | 27d2987 | 2014-09-16 15:27:01 +0000 | [diff] [blame] | 210 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 211 | public: |
| 212 | |
| 213 | // 27.7.1.1.3 Prefix/suffix: |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 214 | class _LIBCPP_TEMPLATE_VIS sentry; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 215 | |
| 216 | // 27.7.1.2 Formatted input: |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 217 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 218 | basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) |
| 219 | { return __pf(*this); } |
| 220 | |
| 221 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 222 | basic_istream& operator>>(basic_ios<char_type, traits_type>& |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 223 | (*__pf)(basic_ios<char_type, traits_type>&)) |
| 224 | { __pf(*this); return *this; } |
| 225 | |
| 226 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 227 | basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) |
| 228 | { __pf(*this); return *this; } |
| 229 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 230 | basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb); |
| 231 | basic_istream& operator>>(bool& __n); |
| 232 | basic_istream& operator>>(short& __n); |
| 233 | basic_istream& operator>>(unsigned short& __n); |
| 234 | basic_istream& operator>>(int& __n); |
| 235 | basic_istream& operator>>(unsigned int& __n); |
| 236 | basic_istream& operator>>(long& __n); |
| 237 | basic_istream& operator>>(unsigned long& __n); |
| 238 | basic_istream& operator>>(long long& __n); |
| 239 | basic_istream& operator>>(unsigned long long& __n); |
| 240 | basic_istream& operator>>(float& __f); |
| 241 | basic_istream& operator>>(double& __f); |
| 242 | basic_istream& operator>>(long double& __f); |
| 243 | basic_istream& operator>>(void*& __p); |
| 244 | |
| 245 | // 27.7.1.3 Unformatted input: |
Howard Hinnant | 64da260 | 2010-09-22 15:29:08 +0000 | [diff] [blame] | 246 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 247 | streamsize gcount() const {return __gc_;} |
| 248 | int_type get(); |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 249 | |
| 250 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 251 | basic_istream& get(char_type& __c) { |
| 252 | int_type __ch = get(); |
| 253 | if (__ch != traits_type::eof()) |
| 254 | __c = traits_type::to_char_type(__ch); |
| 255 | return *this; |
| 256 | } |
| 257 | |
| 258 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 259 | basic_istream& get(char_type* __s, streamsize __n) |
| 260 | { return get(__s, __n, this->widen('\n')); } |
| 261 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 262 | basic_istream& get(char_type* __s, streamsize __n, char_type __dlm); |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 263 | |
| 264 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 265 | basic_istream& get(basic_streambuf<char_type, traits_type>& __sb) |
| 266 | { return get(__sb, this->widen('\n')); } |
| 267 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 268 | basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm); |
| 269 | |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 270 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 271 | basic_istream& getline(char_type* __s, streamsize __n) |
| 272 | { return getline(__s, __n, this->widen('\n')); } |
| 273 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 274 | basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm); |
| 275 | |
| 276 | basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof()); |
| 277 | int_type peek(); |
| 278 | basic_istream& read (char_type* __s, streamsize __n); |
| 279 | streamsize readsome(char_type* __s, streamsize __n); |
| 280 | |
| 281 | basic_istream& putback(char_type __c); |
| 282 | basic_istream& unget(); |
| 283 | int sync(); |
| 284 | |
| 285 | pos_type tellg(); |
| 286 | basic_istream& seekg(pos_type __pos); |
| 287 | basic_istream& seekg(off_type __off, ios_base::seekdir __dir); |
| 288 | }; |
| 289 | |
| 290 | template <class _CharT, class _Traits> |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 291 | class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 292 | { |
| 293 | bool __ok_; |
| 294 | |
| 295 | sentry(const sentry&); // = delete; |
| 296 | sentry& operator=(const sentry&); // = delete; |
| 297 | |
| 298 | public: |
| 299 | explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); |
| 300 | // ~sentry() = default; |
| 301 | |
Howard Hinnant | 64da260 | 2010-09-22 15:29:08 +0000 | [diff] [blame] | 302 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 86a291f | 2012-02-21 21:46:43 +0000 | [diff] [blame] | 303 | _LIBCPP_EXPLICIT |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 304 | operator bool() const {return __ok_;} |
| 305 | }; |
| 306 | |
| 307 | template <class _CharT, class _Traits> |
| 308 | basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is, |
| 309 | bool __noskipws) |
| 310 | : __ok_(false) |
| 311 | { |
| 312 | if (__is.good()) |
| 313 | { |
| 314 | if (__is.tie()) |
| 315 | __is.tie()->flush(); |
| 316 | if (!__noskipws && (__is.flags() & ios_base::skipws)) |
| 317 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 318 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 319 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 320 | _Ip __i(__is); |
| 321 | _Ip __eof; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 322 | for (; __i != __eof; ++__i) |
| 323 | if (!__ct.is(__ct.space, *__i)) |
| 324 | break; |
| 325 | if (__i == __eof) |
| 326 | __is.setstate(ios_base::failbit | ios_base::eofbit); |
| 327 | } |
| 328 | __ok_ = __is.good(); |
| 329 | } |
| 330 | else |
| 331 | __is.setstate(ios_base::failbit); |
| 332 | } |
| 333 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 334 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 335 | |
| 336 | template <class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 337 | basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) |
| 338 | : __gc_(__rhs.__gc_) |
| 339 | { |
| 340 | __rhs.__gc_ = 0; |
| 341 | this->move(__rhs); |
| 342 | } |
| 343 | |
| 344 | template <class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 345 | basic_istream<_CharT, _Traits>& |
| 346 | basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) |
| 347 | { |
| 348 | swap(__rhs); |
| 349 | return *this; |
| 350 | } |
| 351 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 352 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 353 | |
| 354 | template <class _CharT, class _Traits> |
| 355 | basic_istream<_CharT, _Traits>::~basic_istream() |
| 356 | { |
| 357 | } |
| 358 | |
| 359 | template <class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 360 | basic_istream<_CharT, _Traits>& |
| 361 | basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n) |
| 362 | { |
| 363 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 364 | try |
| 365 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 366 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 367 | sentry __s(*this); |
| 368 | if (__s) |
| 369 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 370 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 371 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 372 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 373 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 374 | this->setstate(__err); |
| 375 | } |
| 376 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 377 | } |
| 378 | catch (...) |
| 379 | { |
| 380 | this->__set_badbit_and_consider_rethrow(); |
| 381 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 382 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 383 | return *this; |
| 384 | } |
| 385 | |
| 386 | template <class _CharT, class _Traits> |
| 387 | basic_istream<_CharT, _Traits>& |
| 388 | basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n) |
| 389 | { |
| 390 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 391 | try |
| 392 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 393 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 394 | sentry __s(*this); |
| 395 | if (__s) |
| 396 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 397 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 398 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 399 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 400 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 401 | this->setstate(__err); |
| 402 | } |
| 403 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 404 | } |
| 405 | catch (...) |
| 406 | { |
| 407 | this->__set_badbit_and_consider_rethrow(); |
| 408 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 409 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 410 | return *this; |
| 411 | } |
| 412 | |
| 413 | template <class _CharT, class _Traits> |
| 414 | basic_istream<_CharT, _Traits>& |
| 415 | basic_istream<_CharT, _Traits>::operator>>(long& __n) |
| 416 | { |
| 417 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 418 | try |
| 419 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 420 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 421 | sentry __s(*this); |
| 422 | if (__s) |
| 423 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 424 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 425 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 426 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 427 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 428 | this->setstate(__err); |
| 429 | } |
| 430 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 431 | } |
| 432 | catch (...) |
| 433 | { |
| 434 | this->__set_badbit_and_consider_rethrow(); |
| 435 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 436 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 437 | return *this; |
| 438 | } |
| 439 | |
| 440 | template <class _CharT, class _Traits> |
| 441 | basic_istream<_CharT, _Traits>& |
| 442 | basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n) |
| 443 | { |
| 444 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 445 | try |
| 446 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 447 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 448 | sentry __s(*this); |
| 449 | if (__s) |
| 450 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 451 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 452 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 453 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 454 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 455 | this->setstate(__err); |
| 456 | } |
| 457 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 458 | } |
| 459 | catch (...) |
| 460 | { |
| 461 | this->__set_badbit_and_consider_rethrow(); |
| 462 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 463 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 464 | return *this; |
| 465 | } |
| 466 | |
| 467 | template <class _CharT, class _Traits> |
| 468 | basic_istream<_CharT, _Traits>& |
| 469 | basic_istream<_CharT, _Traits>::operator>>(long long& __n) |
| 470 | { |
| 471 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 472 | try |
| 473 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 474 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 475 | sentry __s(*this); |
| 476 | if (__s) |
| 477 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 478 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 479 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 480 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 481 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 482 | this->setstate(__err); |
| 483 | } |
| 484 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 485 | } |
| 486 | catch (...) |
| 487 | { |
| 488 | this->__set_badbit_and_consider_rethrow(); |
| 489 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 490 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 491 | return *this; |
| 492 | } |
| 493 | |
| 494 | template <class _CharT, class _Traits> |
| 495 | basic_istream<_CharT, _Traits>& |
| 496 | basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n) |
| 497 | { |
| 498 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 499 | try |
| 500 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 501 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 502 | sentry __s(*this); |
| 503 | if (__s) |
| 504 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 505 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 506 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 507 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 508 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 509 | this->setstate(__err); |
| 510 | } |
| 511 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 512 | } |
| 513 | catch (...) |
| 514 | { |
| 515 | this->__set_badbit_and_consider_rethrow(); |
| 516 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 517 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 518 | return *this; |
| 519 | } |
| 520 | |
| 521 | template <class _CharT, class _Traits> |
| 522 | basic_istream<_CharT, _Traits>& |
| 523 | basic_istream<_CharT, _Traits>::operator>>(float& __n) |
| 524 | { |
| 525 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 526 | try |
| 527 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 528 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 529 | sentry __s(*this); |
| 530 | if (__s) |
| 531 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 532 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 533 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 534 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 535 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 536 | this->setstate(__err); |
| 537 | } |
| 538 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 539 | } |
| 540 | catch (...) |
| 541 | { |
| 542 | this->__set_badbit_and_consider_rethrow(); |
| 543 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 544 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 545 | return *this; |
| 546 | } |
| 547 | |
| 548 | template <class _CharT, class _Traits> |
| 549 | basic_istream<_CharT, _Traits>& |
| 550 | basic_istream<_CharT, _Traits>::operator>>(double& __n) |
| 551 | { |
| 552 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 553 | try |
| 554 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 555 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 556 | sentry __s(*this); |
| 557 | if (__s) |
| 558 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 559 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 560 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 561 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 562 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 563 | this->setstate(__err); |
| 564 | } |
| 565 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 566 | } |
| 567 | catch (...) |
| 568 | { |
| 569 | this->__set_badbit_and_consider_rethrow(); |
| 570 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 571 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 572 | return *this; |
| 573 | } |
| 574 | |
| 575 | template <class _CharT, class _Traits> |
| 576 | basic_istream<_CharT, _Traits>& |
| 577 | basic_istream<_CharT, _Traits>::operator>>(long double& __n) |
| 578 | { |
| 579 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 580 | try |
| 581 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 582 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 583 | sentry __s(*this); |
| 584 | if (__s) |
| 585 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 586 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 587 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 588 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 589 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 590 | this->setstate(__err); |
| 591 | } |
| 592 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 593 | } |
| 594 | catch (...) |
| 595 | { |
| 596 | this->__set_badbit_and_consider_rethrow(); |
| 597 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 598 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 599 | return *this; |
| 600 | } |
| 601 | |
| 602 | template <class _CharT, class _Traits> |
| 603 | basic_istream<_CharT, _Traits>& |
| 604 | basic_istream<_CharT, _Traits>::operator>>(bool& __n) |
| 605 | { |
| 606 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 607 | try |
| 608 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 609 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 610 | sentry __s(*this); |
| 611 | if (__s) |
| 612 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 613 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 614 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 615 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 616 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 617 | this->setstate(__err); |
| 618 | } |
| 619 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 620 | } |
| 621 | catch (...) |
| 622 | { |
| 623 | this->__set_badbit_and_consider_rethrow(); |
| 624 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 625 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 626 | return *this; |
| 627 | } |
| 628 | |
| 629 | template <class _CharT, class _Traits> |
| 630 | basic_istream<_CharT, _Traits>& |
| 631 | basic_istream<_CharT, _Traits>::operator>>(void*& __n) |
| 632 | { |
| 633 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 634 | try |
| 635 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 636 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 637 | sentry __s(*this); |
| 638 | if (__s) |
| 639 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 640 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 641 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 642 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 643 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 644 | this->setstate(__err); |
| 645 | } |
| 646 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 647 | } |
| 648 | catch (...) |
| 649 | { |
| 650 | this->__set_badbit_and_consider_rethrow(); |
| 651 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 652 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 653 | return *this; |
| 654 | } |
| 655 | |
| 656 | template <class _CharT, class _Traits> |
| 657 | basic_istream<_CharT, _Traits>& |
| 658 | basic_istream<_CharT, _Traits>::operator>>(short& __n) |
| 659 | { |
| 660 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 661 | try |
| 662 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 663 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 664 | sentry __s(*this); |
| 665 | if (__s) |
| 666 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 667 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 668 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 669 | ios_base::iostate __err = ios_base::goodbit; |
| 670 | long __temp; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 671 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 672 | if (__temp < numeric_limits<short>::min()) |
| 673 | { |
| 674 | __err |= ios_base::failbit; |
| 675 | __n = numeric_limits<short>::min(); |
| 676 | } |
| 677 | else if (__temp > numeric_limits<short>::max()) |
| 678 | { |
| 679 | __err |= ios_base::failbit; |
| 680 | __n = numeric_limits<short>::max(); |
| 681 | } |
| 682 | else |
| 683 | __n = static_cast<short>(__temp); |
| 684 | this->setstate(__err); |
| 685 | } |
| 686 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 687 | } |
| 688 | catch (...) |
| 689 | { |
| 690 | this->__set_badbit_and_consider_rethrow(); |
| 691 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 692 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 693 | return *this; |
| 694 | } |
| 695 | |
| 696 | template <class _CharT, class _Traits> |
| 697 | basic_istream<_CharT, _Traits>& |
| 698 | basic_istream<_CharT, _Traits>::operator>>(int& __n) |
| 699 | { |
| 700 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 701 | try |
| 702 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 703 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 704 | sentry __s(*this); |
| 705 | if (__s) |
| 706 | { |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 707 | typedef istreambuf_iterator<char_type, traits_type> _Ip; |
| 708 | typedef num_get<char_type, _Ip> _Fp; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 709 | ios_base::iostate __err = ios_base::goodbit; |
| 710 | long __temp; |
Howard Hinnant | c834c51 | 2011-11-29 18:15:50 +0000 | [diff] [blame] | 711 | use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 712 | if (__temp < numeric_limits<int>::min()) |
| 713 | { |
| 714 | __err |= ios_base::failbit; |
| 715 | __n = numeric_limits<int>::min(); |
| 716 | } |
| 717 | else if (__temp > numeric_limits<int>::max()) |
| 718 | { |
| 719 | __err |= ios_base::failbit; |
| 720 | __n = numeric_limits<int>::max(); |
| 721 | } |
| 722 | else |
| 723 | __n = static_cast<int>(__temp); |
| 724 | this->setstate(__err); |
| 725 | } |
| 726 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 727 | } |
| 728 | catch (...) |
| 729 | { |
| 730 | this->__set_badbit_and_consider_rethrow(); |
| 731 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 732 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 733 | return *this; |
| 734 | } |
| 735 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 736 | template<class _CharT, class _Traits> |
| 737 | basic_istream<_CharT, _Traits>& |
| 738 | operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s) |
| 739 | { |
| 740 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 741 | try |
| 742 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 743 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 744 | typename basic_istream<_CharT, _Traits>::sentry __sen(__is); |
| 745 | if (__sen) |
| 746 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 747 | streamsize __n = __is.width(); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 748 | if (__n <= 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 749 | __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1; |
| 750 | streamsize __c = 0; |
| 751 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 752 | ios_base::iostate __err = ios_base::goodbit; |
| 753 | while (__c < __n-1) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 754 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 755 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| 756 | if (_Traits::eq_int_type(__i, _Traits::eof())) |
| 757 | { |
| 758 | __err |= ios_base::eofbit; |
| 759 | break; |
| 760 | } |
| 761 | _CharT __ch = _Traits::to_char_type(__i); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 762 | if (__ct.is(__ct.space, __ch)) |
| 763 | break; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 764 | *__s++ = __ch; |
| 765 | ++__c; |
| 766 | __is.rdbuf()->sbumpc(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 767 | } |
| 768 | *__s = _CharT(); |
| 769 | __is.width(0); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 770 | if (__c == 0) |
| 771 | __err |= ios_base::failbit; |
| 772 | __is.setstate(__err); |
| 773 | } |
| 774 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 775 | } |
| 776 | catch (...) |
| 777 | { |
| 778 | __is.__set_badbit_and_consider_rethrow(); |
| 779 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 780 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 781 | return __is; |
| 782 | } |
| 783 | |
| 784 | template<class _Traits> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 785 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 786 | basic_istream<char, _Traits>& |
| 787 | operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s) |
| 788 | { |
| 789 | return __is >> (char*)__s; |
| 790 | } |
| 791 | |
| 792 | template<class _Traits> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 793 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 794 | basic_istream<char, _Traits>& |
| 795 | operator>>(basic_istream<char, _Traits>& __is, signed char* __s) |
| 796 | { |
| 797 | return __is >> (char*)__s; |
| 798 | } |
| 799 | |
| 800 | template<class _CharT, class _Traits> |
| 801 | basic_istream<_CharT, _Traits>& |
| 802 | operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) |
| 803 | { |
| 804 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 805 | try |
| 806 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 807 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 808 | typename basic_istream<_CharT, _Traits>::sentry __sen(__is); |
| 809 | if (__sen) |
| 810 | { |
Howard Hinnant | b2e8a42 | 2011-02-27 18:02:02 +0000 | [diff] [blame] | 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); |
| 814 | else |
| 815 | __c = _Traits::to_char_type(__i); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 816 | } |
| 817 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 818 | } |
| 819 | catch (...) |
| 820 | { |
| 821 | __is.__set_badbit_and_consider_rethrow(); |
| 822 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 823 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 824 | return __is; |
| 825 | } |
| 826 | |
| 827 | template<class _Traits> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 828 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 829 | basic_istream<char, _Traits>& |
| 830 | operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c) |
| 831 | { |
| 832 | return __is >> (char&)__c; |
| 833 | } |
| 834 | |
| 835 | template<class _Traits> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 836 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 837 | basic_istream<char, _Traits>& |
| 838 | operator>>(basic_istream<char, _Traits>& __is, signed char& __c) |
| 839 | { |
| 840 | return __is >> (char&)__c; |
| 841 | } |
| 842 | |
| 843 | template<class _CharT, class _Traits> |
| 844 | basic_istream<_CharT, _Traits>& |
| 845 | basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb) |
| 846 | { |
| 847 | __gc_ = 0; |
| 848 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 849 | try |
| 850 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 851 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 852 | sentry __s(*this, true); |
| 853 | if (__s) |
| 854 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 855 | if (__sb) |
| 856 | { |
| 857 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 858 | try |
| 859 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 860 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 861 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 862 | while (true) |
| 863 | { |
| 864 | typename traits_type::int_type __i = this->rdbuf()->sgetc(); |
| 865 | if (traits_type::eq_int_type(__i, _Traits::eof())) |
| 866 | { |
| 867 | __err |= ios_base::eofbit; |
| 868 | break; |
| 869 | } |
| 870 | if (traits_type::eq_int_type( |
| 871 | __sb->sputc(traits_type::to_char_type(__i)), |
| 872 | traits_type::eof())) |
| 873 | break; |
| 874 | ++__gc_; |
| 875 | this->rdbuf()->sbumpc(); |
| 876 | } |
| 877 | if (__gc_ == 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 878 | __err |= ios_base::failbit; |
| 879 | this->setstate(__err); |
| 880 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 881 | } |
| 882 | catch (...) |
| 883 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 884 | if (__gc_ == 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 885 | this->__set_failbit_and_consider_rethrow(); |
| 886 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 887 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 888 | } |
| 889 | else |
| 890 | this->setstate(ios_base::failbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 891 | } |
| 892 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 893 | } |
| 894 | catch (...) |
| 895 | { |
| 896 | this->__set_badbit_and_consider_rethrow(); |
| 897 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 898 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 899 | return *this; |
| 900 | } |
| 901 | |
| 902 | template<class _CharT, class _Traits> |
| 903 | typename basic_istream<_CharT, _Traits>::int_type |
| 904 | basic_istream<_CharT, _Traits>::get() |
| 905 | { |
| 906 | __gc_ = 0; |
| 907 | int_type __r = traits_type::eof(); |
| 908 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 909 | try |
| 910 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 911 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 912 | sentry __s(*this, true); |
| 913 | if (__s) |
| 914 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 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); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 918 | else |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 919 | __gc_ = 1; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 920 | } |
| 921 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 922 | } |
| 923 | catch (...) |
| 924 | { |
| 925 | this->__set_badbit_and_consider_rethrow(); |
| 926 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 927 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 928 | return __r; |
| 929 | } |
| 930 | |
| 931 | template<class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 932 | basic_istream<_CharT, _Traits>& |
| 933 | basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm) |
| 934 | { |
| 935 | __gc_ = 0; |
| 936 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 937 | try |
| 938 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 939 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 940 | sentry __sen(*this, true); |
| 941 | if (__sen) |
| 942 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 943 | if (__n > 0) |
| 944 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 945 | ios_base::iostate __err = ios_base::goodbit; |
| 946 | while (__gc_ < __n-1) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 947 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 948 | int_type __i = this->rdbuf()->sgetc(); |
| 949 | if (traits_type::eq_int_type(__i, traits_type::eof())) |
| 950 | { |
| 951 | __err |= ios_base::eofbit; |
| 952 | break; |
| 953 | } |
| 954 | char_type __ch = traits_type::to_char_type(__i); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 955 | if (traits_type::eq(__ch, __dlm)) |
| 956 | break; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 957 | *__s++ = __ch; |
| 958 | ++__gc_; |
| 959 | this->rdbuf()->sbumpc(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 960 | } |
| 961 | *__s = char_type(); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 962 | if (__gc_ == 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 963 | __err |= ios_base::failbit; |
| 964 | this->setstate(__err); |
| 965 | } |
| 966 | else |
| 967 | this->setstate(ios_base::failbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 968 | } |
| 969 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 970 | } |
| 971 | catch (...) |
| 972 | { |
| 973 | this->__set_badbit_and_consider_rethrow(); |
| 974 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 975 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 976 | return *this; |
| 977 | } |
| 978 | |
| 979 | template<class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 980 | basic_istream<_CharT, _Traits>& |
| 981 | basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb, |
| 982 | char_type __dlm) |
| 983 | { |
| 984 | __gc_ = 0; |
| 985 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 986 | try |
| 987 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 988 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 989 | sentry __sen(*this, true); |
| 990 | if (__sen) |
| 991 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 992 | ios_base::iostate __err = ios_base::goodbit; |
| 993 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 994 | try |
| 995 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 996 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 997 | while (true) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 998 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 999 | typename traits_type::int_type __i = this->rdbuf()->sgetc(); |
| 1000 | if (traits_type::eq_int_type(__i, traits_type::eof())) |
| 1001 | { |
| 1002 | __err |= ios_base::eofbit; |
| 1003 | break; |
| 1004 | } |
| 1005 | char_type __ch = traits_type::to_char_type(__i); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1006 | if (traits_type::eq(__ch, __dlm)) |
| 1007 | break; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1008 | if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof())) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1009 | break; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1010 | ++__gc_; |
| 1011 | this->rdbuf()->sbumpc(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1012 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1013 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1014 | } |
| 1015 | catch (...) |
| 1016 | { |
| 1017 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1018 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1019 | if (__gc_ == 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1020 | __err |= ios_base::failbit; |
| 1021 | this->setstate(__err); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1022 | } |
| 1023 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1024 | } |
| 1025 | catch (...) |
| 1026 | { |
| 1027 | this->__set_badbit_and_consider_rethrow(); |
| 1028 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1029 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1030 | return *this; |
| 1031 | } |
| 1032 | |
| 1033 | template<class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1034 | basic_istream<_CharT, _Traits>& |
| 1035 | basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm) |
| 1036 | { |
| 1037 | __gc_ = 0; |
| 1038 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1039 | try |
| 1040 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1041 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1042 | sentry __sen(*this, true); |
| 1043 | if (__sen) |
| 1044 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1045 | ios_base::iostate __err = ios_base::goodbit; |
| 1046 | while (true) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1047 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1048 | typename traits_type::int_type __i = this->rdbuf()->sgetc(); |
| 1049 | if (traits_type::eq_int_type(__i, traits_type::eof())) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1050 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1051 | __err |= ios_base::eofbit; |
| 1052 | break; |
| 1053 | } |
| 1054 | char_type __ch = traits_type::to_char_type(__i); |
| 1055 | if (traits_type::eq(__ch, __dlm)) |
| 1056 | { |
| 1057 | this->rdbuf()->sbumpc(); |
| 1058 | ++__gc_; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1059 | break; |
| 1060 | } |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1061 | if (__gc_ >= __n-1) |
| 1062 | { |
| 1063 | __err |= ios_base::failbit; |
| 1064 | break; |
| 1065 | } |
| 1066 | *__s++ = __ch; |
| 1067 | this->rdbuf()->sbumpc(); |
| 1068 | ++__gc_; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1069 | } |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1070 | if (__n > 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1071 | *__s = char_type(); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1072 | if (__gc_ == 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1073 | __err |= ios_base::failbit; |
| 1074 | this->setstate(__err); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1075 | } |
| 1076 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1077 | } |
| 1078 | catch (...) |
| 1079 | { |
| 1080 | this->__set_badbit_and_consider_rethrow(); |
| 1081 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1082 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1083 | return *this; |
| 1084 | } |
| 1085 | |
| 1086 | template<class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1087 | basic_istream<_CharT, _Traits>& |
| 1088 | basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) |
| 1089 | { |
| 1090 | __gc_ = 0; |
| 1091 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1092 | try |
| 1093 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1094 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1095 | sentry __sen(*this, true); |
| 1096 | if (__sen) |
| 1097 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1098 | ios_base::iostate __err = ios_base::goodbit; |
| 1099 | if (__n == numeric_limits<streamsize>::max()) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1100 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1101 | while (true) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1102 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1103 | typename traits_type::int_type __i = this->rdbuf()->sbumpc(); |
| 1104 | if (traits_type::eq_int_type(__i, traits_type::eof())) |
| 1105 | { |
| 1106 | __err |= ios_base::eofbit; |
| 1107 | break; |
| 1108 | } |
| 1109 | ++__gc_; |
Howard Hinnant | 4df1e3f | 2013-07-01 00:37:50 +0000 | [diff] [blame] | 1110 | if (traits_type::eq_int_type(__i, __dlm)) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1111 | break; |
| 1112 | } |
| 1113 | } |
| 1114 | else |
| 1115 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1116 | while (__gc_ < __n) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1117 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1118 | typename traits_type::int_type __i = this->rdbuf()->sbumpc(); |
| 1119 | if (traits_type::eq_int_type(__i, traits_type::eof())) |
| 1120 | { |
| 1121 | __err |= ios_base::eofbit; |
| 1122 | break; |
| 1123 | } |
| 1124 | ++__gc_; |
Howard Hinnant | 4df1e3f | 2013-07-01 00:37:50 +0000 | [diff] [blame] | 1125 | if (traits_type::eq_int_type(__i, __dlm)) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1126 | break; |
| 1127 | } |
| 1128 | } |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1129 | this->setstate(__err); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1130 | } |
| 1131 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1132 | } |
| 1133 | catch (...) |
| 1134 | { |
| 1135 | this->__set_badbit_and_consider_rethrow(); |
| 1136 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1137 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1138 | return *this; |
| 1139 | } |
| 1140 | |
| 1141 | template<class _CharT, class _Traits> |
| 1142 | typename basic_istream<_CharT, _Traits>::int_type |
| 1143 | basic_istream<_CharT, _Traits>::peek() |
| 1144 | { |
| 1145 | __gc_ = 0; |
| 1146 | int_type __r = traits_type::eof(); |
| 1147 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1148 | try |
| 1149 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1150 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1151 | sentry __sen(*this, true); |
| 1152 | if (__sen) |
Howard Hinnant | a442737 | 2012-11-01 17:32:07 +0000 | [diff] [blame] | 1153 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1154 | __r = this->rdbuf()->sgetc(); |
Howard Hinnant | a442737 | 2012-11-01 17:32:07 +0000 | [diff] [blame] | 1155 | if (traits_type::eq_int_type(__r, traits_type::eof())) |
| 1156 | this->setstate(ios_base::eofbit); |
| 1157 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1158 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1159 | } |
| 1160 | catch (...) |
| 1161 | { |
| 1162 | this->__set_badbit_and_consider_rethrow(); |
| 1163 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1164 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1165 | return __r; |
| 1166 | } |
| 1167 | |
| 1168 | template<class _CharT, class _Traits> |
| 1169 | basic_istream<_CharT, _Traits>& |
| 1170 | basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) |
| 1171 | { |
| 1172 | __gc_ = 0; |
| 1173 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1174 | try |
| 1175 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1176 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1177 | sentry __sen(*this, true); |
| 1178 | if (__sen) |
| 1179 | { |
Howard Hinnant | 232466c | 2013-03-06 19:27:56 +0000 | [diff] [blame] | 1180 | __gc_ = this->rdbuf()->sgetn(__s, __n); |
| 1181 | if (__gc_ != __n) |
| 1182 | this->setstate(ios_base::failbit | ios_base::eofbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1183 | } |
| 1184 | else |
| 1185 | this->setstate(ios_base::failbit); |
| 1186 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1187 | } |
| 1188 | catch (...) |
| 1189 | { |
| 1190 | this->__set_badbit_and_consider_rethrow(); |
| 1191 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1192 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1193 | return *this; |
| 1194 | } |
| 1195 | |
| 1196 | template<class _CharT, class _Traits> |
| 1197 | streamsize |
| 1198 | basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) |
| 1199 | { |
Howard Hinnant | af8555c | 2012-12-20 15:40:28 +0000 | [diff] [blame] | 1200 | __gc_ = 0; |
Marshall Clow | 1c6e386 | 2016-07-13 16:58:48 +0000 | [diff] [blame] | 1201 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1202 | try |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1203 | { |
Marshall Clow | 1c6e386 | 2016-07-13 16:58:48 +0000 | [diff] [blame] | 1204 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 1205 | sentry __sen(*this, true); |
| 1206 | if (__sen) |
| 1207 | { |
| 1208 | streamsize __c = this->rdbuf()->in_avail(); |
| 1209 | switch (__c) |
| 1210 | { |
| 1211 | case -1: |
| 1212 | this->setstate(ios_base::eofbit); |
| 1213 | break; |
| 1214 | case 0: |
| 1215 | break; |
| 1216 | default: |
| 1217 | read(__s, _VSTD::min(__c, __n)); |
| 1218 | break; |
| 1219 | } |
| 1220 | } |
| 1221 | else |
| 1222 | this->setstate(ios_base::failbit); |
| 1223 | #ifndef _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1224 | } |
Marshall Clow | 1c6e386 | 2016-07-13 16:58:48 +0000 | [diff] [blame] | 1225 | catch (...) |
| 1226 | { |
| 1227 | this->__set_badbit_and_consider_rethrow(); |
| 1228 | } |
| 1229 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1230 | return __gc_; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1231 | } |
| 1232 | |
| 1233 | template<class _CharT, class _Traits> |
| 1234 | basic_istream<_CharT, _Traits>& |
| 1235 | basic_istream<_CharT, _Traits>::putback(char_type __c) |
| 1236 | { |
| 1237 | __gc_ = 0; |
| 1238 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1239 | try |
| 1240 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1241 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | 0c8d6a4 | 2012-08-24 22:03:03 +0000 | [diff] [blame] | 1242 | this->clear(this->rdstate() & ~ios_base::eofbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1243 | sentry __sen(*this, true); |
| 1244 | if (__sen) |
| 1245 | { |
| 1246 | if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof()) |
| 1247 | this->setstate(ios_base::badbit); |
| 1248 | } |
| 1249 | else |
| 1250 | this->setstate(ios_base::failbit); |
| 1251 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1252 | } |
| 1253 | catch (...) |
| 1254 | { |
| 1255 | this->__set_badbit_and_consider_rethrow(); |
| 1256 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1257 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1258 | return *this; |
| 1259 | } |
| 1260 | |
| 1261 | template<class _CharT, class _Traits> |
| 1262 | basic_istream<_CharT, _Traits>& |
| 1263 | basic_istream<_CharT, _Traits>::unget() |
| 1264 | { |
| 1265 | __gc_ = 0; |
| 1266 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1267 | try |
| 1268 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1269 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | 0c8d6a4 | 2012-08-24 22:03:03 +0000 | [diff] [blame] | 1270 | this->clear(this->rdstate() & ~ios_base::eofbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1271 | sentry __sen(*this, true); |
| 1272 | if (__sen) |
| 1273 | { |
| 1274 | if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof()) |
| 1275 | this->setstate(ios_base::badbit); |
| 1276 | } |
| 1277 | else |
| 1278 | this->setstate(ios_base::failbit); |
| 1279 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1280 | } |
| 1281 | catch (...) |
| 1282 | { |
| 1283 | this->__set_badbit_and_consider_rethrow(); |
| 1284 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1285 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1286 | return *this; |
| 1287 | } |
| 1288 | |
| 1289 | template<class _CharT, class _Traits> |
| 1290 | int |
| 1291 | basic_istream<_CharT, _Traits>::sync() |
| 1292 | { |
| 1293 | int __r = 0; |
| 1294 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1295 | try |
| 1296 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1297 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1298 | sentry __sen(*this, true); |
| 1299 | if (__sen) |
| 1300 | { |
| 1301 | if (this->rdbuf() == 0) |
| 1302 | return -1; |
| 1303 | if (this->rdbuf()->pubsync() == -1) |
| 1304 | { |
| 1305 | this->setstate(ios_base::badbit); |
| 1306 | return -1; |
| 1307 | } |
| 1308 | } |
| 1309 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1310 | } |
| 1311 | catch (...) |
| 1312 | { |
| 1313 | this->__set_badbit_and_consider_rethrow(); |
| 1314 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1315 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1316 | return __r; |
| 1317 | } |
| 1318 | |
| 1319 | template<class _CharT, class _Traits> |
| 1320 | typename basic_istream<_CharT, _Traits>::pos_type |
| 1321 | basic_istream<_CharT, _Traits>::tellg() |
| 1322 | { |
| 1323 | pos_type __r(-1); |
| 1324 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1325 | try |
| 1326 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1327 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1328 | sentry __sen(*this, true); |
| 1329 | if (__sen) |
| 1330 | __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); |
| 1331 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1332 | } |
| 1333 | catch (...) |
| 1334 | { |
| 1335 | this->__set_badbit_and_consider_rethrow(); |
| 1336 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1337 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1338 | return __r; |
| 1339 | } |
| 1340 | |
| 1341 | template<class _CharT, class _Traits> |
| 1342 | basic_istream<_CharT, _Traits>& |
| 1343 | basic_istream<_CharT, _Traits>::seekg(pos_type __pos) |
| 1344 | { |
| 1345 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1346 | try |
| 1347 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1348 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | 0c8d6a4 | 2012-08-24 22:03:03 +0000 | [diff] [blame] | 1349 | this->clear(this->rdstate() & ~ios_base::eofbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1350 | sentry __sen(*this, true); |
| 1351 | if (__sen) |
Marshall Clow | 29c4daa | 2013-10-31 22:20:45 +0000 | [diff] [blame] | 1352 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1353 | if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) |
| 1354 | this->setstate(ios_base::failbit); |
Marshall Clow | 29c4daa | 2013-10-31 22:20:45 +0000 | [diff] [blame] | 1355 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1356 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1357 | } |
| 1358 | catch (...) |
| 1359 | { |
| 1360 | this->__set_badbit_and_consider_rethrow(); |
| 1361 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1362 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1363 | return *this; |
| 1364 | } |
| 1365 | |
| 1366 | template<class _CharT, class _Traits> |
| 1367 | basic_istream<_CharT, _Traits>& |
| 1368 | basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) |
| 1369 | { |
| 1370 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1371 | try |
| 1372 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1373 | #endif // _LIBCPP_NO_EXCEPTIONS |
Marshall Clow | 41d9e3a | 2015-10-25 18:31:51 +0000 | [diff] [blame] | 1374 | this->clear(this->rdstate() & ~ios_base::eofbit); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1375 | sentry __sen(*this, true); |
| 1376 | if (__sen) |
Marshall Clow | 29c4daa | 2013-10-31 22:20:45 +0000 | [diff] [blame] | 1377 | { |
| 1378 | if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) |
| 1379 | this->setstate(ios_base::failbit); |
| 1380 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1381 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1382 | } |
| 1383 | catch (...) |
| 1384 | { |
| 1385 | this->__set_badbit_and_consider_rethrow(); |
| 1386 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1387 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1388 | return *this; |
| 1389 | } |
| 1390 | |
| 1391 | template <class _CharT, class _Traits> |
| 1392 | basic_istream<_CharT, _Traits>& |
| 1393 | ws(basic_istream<_CharT, _Traits>& __is) |
| 1394 | { |
| 1395 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1396 | try |
| 1397 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1398 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1399 | typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); |
| 1400 | if (__sen) |
| 1401 | { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1402 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1403 | while (true) |
| 1404 | { |
| 1405 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| 1406 | if (_Traits::eq_int_type(__i, _Traits::eof())) |
| 1407 | { |
| 1408 | __is.setstate(ios_base::eofbit); |
| 1409 | break; |
| 1410 | } |
| 1411 | if (!__ct.is(__ct.space, _Traits::to_char_type(__i))) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1412 | break; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1413 | __is.rdbuf()->sbumpc(); |
| 1414 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1415 | } |
| 1416 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1417 | } |
| 1418 | catch (...) |
| 1419 | { |
| 1420 | __is.__set_badbit_and_consider_rethrow(); |
| 1421 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1422 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1423 | return __is; |
| 1424 | } |
| 1425 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1426 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1427 | |
| 1428 | template <class _CharT, class _Traits, class _Tp> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 1429 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1430 | basic_istream<_CharT, _Traits>& |
Eric Fiselier | 7955ef6 | 2016-07-24 04:07:22 +0000 | [diff] [blame] | 1431 | operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1432 | { |
Eric Fiselier | 7955ef6 | 2016-07-24 04:07:22 +0000 | [diff] [blame] | 1433 | __is >> _VSTD::forward<_Tp>(__x); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1434 | return __is; |
| 1435 | } |
| 1436 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1437 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1438 | |
| 1439 | template <class _CharT, class _Traits> |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 1440 | class _LIBCPP_TEMPLATE_VIS basic_iostream |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1441 | : public basic_istream<_CharT, _Traits>, |
| 1442 | public basic_ostream<_CharT, _Traits> |
| 1443 | { |
| 1444 | public: |
| 1445 | // types: |
| 1446 | typedef _CharT char_type; |
| 1447 | typedef _Traits traits_type; |
| 1448 | typedef typename traits_type::int_type int_type; |
| 1449 | typedef typename traits_type::pos_type pos_type; |
| 1450 | typedef typename traits_type::off_type off_type; |
| 1451 | |
| 1452 | // constructor/destructor |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 1453 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 1454 | explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb) |
| 1455 | : basic_istream<_CharT, _Traits>(__sb) |
| 1456 | {} |
| 1457 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1458 | virtual ~basic_iostream(); |
| 1459 | protected: |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1460 | #ifndef _LIBCPP_CXX03_LANG |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 1461 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1462 | basic_iostream(basic_iostream&& __rhs); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1463 | |
| 1464 | // assign/swap |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 1465 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1466 | basic_iostream& operator=(basic_iostream&& __rhs); |
| 1467 | #endif |
Eric Fiselier | 815ed73 | 2016-09-16 00:00:48 +0000 | [diff] [blame] | 1468 | inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY |
| 1469 | void swap(basic_iostream& __rhs) |
| 1470 | { basic_istream<char_type, traits_type>::swap(__rhs); } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1471 | public: |
| 1472 | }; |
| 1473 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1474 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1475 | |
| 1476 | template <class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1477 | basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1478 | : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1479 | { |
| 1480 | } |
| 1481 | |
| 1482 | template <class _CharT, class _Traits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1483 | basic_iostream<_CharT, _Traits>& |
| 1484 | basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) |
| 1485 | { |
| 1486 | swap(__rhs); |
| 1487 | return *this; |
| 1488 | } |
| 1489 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1490 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1491 | |
| 1492 | template <class _CharT, class _Traits> |
| 1493 | basic_iostream<_CharT, _Traits>::~basic_iostream() |
| 1494 | { |
| 1495 | } |
| 1496 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1497 | template<class _CharT, class _Traits, class _Allocator> |
| 1498 | basic_istream<_CharT, _Traits>& |
| 1499 | operator>>(basic_istream<_CharT, _Traits>& __is, |
| 1500 | basic_string<_CharT, _Traits, _Allocator>& __str) |
| 1501 | { |
| 1502 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1503 | try |
| 1504 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1505 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1506 | typename basic_istream<_CharT, _Traits>::sentry __sen(__is); |
| 1507 | if (__sen) |
| 1508 | { |
| 1509 | __str.clear(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1510 | streamsize __n = __is.width(); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1511 | if (__n <= 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1512 | __n = __str.max_size(); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1513 | if (__n <= 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1514 | __n = numeric_limits<streamsize>::max(); |
| 1515 | streamsize __c = 0; |
| 1516 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1517 | ios_base::iostate __err = ios_base::goodbit; |
| 1518 | while (__c < __n) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1519 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1520 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| 1521 | if (_Traits::eq_int_type(__i, _Traits::eof())) |
| 1522 | { |
| 1523 | __err |= ios_base::eofbit; |
| 1524 | break; |
| 1525 | } |
| 1526 | _CharT __ch = _Traits::to_char_type(__i); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1527 | if (__ct.is(__ct.space, __ch)) |
| 1528 | break; |
| 1529 | __str.push_back(__ch); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1530 | ++__c; |
| 1531 | __is.rdbuf()->sbumpc(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1532 | } |
| 1533 | __is.width(0); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1534 | if (__c == 0) |
| 1535 | __err |= ios_base::failbit; |
| 1536 | __is.setstate(__err); |
| 1537 | } |
| 1538 | else |
| 1539 | __is.setstate(ios_base::failbit); |
| 1540 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1541 | } |
| 1542 | catch (...) |
| 1543 | { |
| 1544 | __is.__set_badbit_and_consider_rethrow(); |
| 1545 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1546 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1547 | return __is; |
| 1548 | } |
| 1549 | |
| 1550 | template<class _CharT, class _Traits, class _Allocator> |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1551 | basic_istream<_CharT, _Traits>& |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1552 | getline(basic_istream<_CharT, _Traits>& __is, |
| 1553 | basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) |
| 1554 | { |
| 1555 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1556 | try |
| 1557 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1558 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1559 | typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); |
| 1560 | if (__sen) |
| 1561 | { |
| 1562 | __str.clear(); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1563 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | e992f76 | 2011-10-09 15:20:46 +0000 | [diff] [blame] | 1564 | streamsize __extr = 0; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1565 | while (true) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1566 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1567 | typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); |
| 1568 | if (_Traits::eq_int_type(__i, _Traits::eof())) |
| 1569 | { |
| 1570 | __err |= ios_base::eofbit; |
| 1571 | break; |
| 1572 | } |
Howard Hinnant | e992f76 | 2011-10-09 15:20:46 +0000 | [diff] [blame] | 1573 | ++__extr; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1574 | _CharT __ch = _Traits::to_char_type(__i); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1575 | if (_Traits::eq(__ch, __dlm)) |
| 1576 | break; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1577 | __str.push_back(__ch); |
| 1578 | if (__str.size() == __str.max_size()) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1579 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1580 | __err |= ios_base::failbit; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1581 | break; |
| 1582 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1583 | } |
Howard Hinnant | e992f76 | 2011-10-09 15:20:46 +0000 | [diff] [blame] | 1584 | if (__extr == 0) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1585 | __err |= ios_base::failbit; |
| 1586 | __is.setstate(__err); |
| 1587 | } |
| 1588 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1589 | } |
| 1590 | catch (...) |
| 1591 | { |
| 1592 | __is.__set_badbit_and_consider_rethrow(); |
| 1593 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1594 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1595 | return __is; |
| 1596 | } |
| 1597 | |
| 1598 | template<class _CharT, class _Traits, class _Allocator> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 1599 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1600 | basic_istream<_CharT, _Traits>& |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1601 | getline(basic_istream<_CharT, _Traits>& __is, |
| 1602 | basic_string<_CharT, _Traits, _Allocator>& __str) |
| 1603 | { |
| 1604 | return getline(__is, __str, __is.widen('\n')); |
| 1605 | } |
| 1606 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1607 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1608 | |
| 1609 | template<class _CharT, class _Traits, class _Allocator> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 1610 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1611 | basic_istream<_CharT, _Traits>& |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1612 | getline(basic_istream<_CharT, _Traits>&& __is, |
| 1613 | basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) |
| 1614 | { |
| 1615 | return getline(__is, __str, __dlm); |
| 1616 | } |
| 1617 | |
| 1618 | template<class _CharT, class _Traits, class _Allocator> |
Evgeniy Stepanov | b925426 | 2016-01-08 19:21:02 +0000 | [diff] [blame] | 1619 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1620 | basic_istream<_CharT, _Traits>& |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1621 | getline(basic_istream<_CharT, _Traits>&& __is, |
| 1622 | basic_string<_CharT, _Traits, _Allocator>& __str) |
| 1623 | { |
| 1624 | return getline(__is, __str, __is.widen('\n')); |
| 1625 | } |
| 1626 | |
Eric Fiselier | 78ccf77 | 2017-04-18 23:38:41 +0000 | [diff] [blame^] | 1627 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1628 | |
| 1629 | template <class _CharT, class _Traits, size_t _Size> |
| 1630 | basic_istream<_CharT, _Traits>& |
| 1631 | operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) |
| 1632 | { |
| 1633 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1634 | try |
| 1635 | { |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1636 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1637 | typename basic_istream<_CharT, _Traits>::sentry __sen(__is); |
| 1638 | if (__sen) |
| 1639 | { |
| 1640 | basic_string<_CharT, _Traits> __str; |
| 1641 | const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); |
Eric Fiselier | 37c2215 | 2016-12-24 00:24:44 +0000 | [diff] [blame] | 1642 | size_t __c = 0; |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1643 | ios_base::iostate __err = ios_base::goodbit; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1644 | _CharT __zero = __ct.widen('0'); |
| 1645 | _CharT __one = __ct.widen('1'); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1646 | while (__c < _Size) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1647 | { |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1648 | typename _Traits::int_type __i = __is.rdbuf()->sgetc(); |
| 1649 | if (_Traits::eq_int_type(__i, _Traits::eof())) |
| 1650 | { |
| 1651 | __err |= ios_base::eofbit; |
| 1652 | break; |
| 1653 | } |
| 1654 | _CharT __ch = _Traits::to_char_type(__i); |
| 1655 | if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one)) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1656 | break; |
| 1657 | __str.push_back(__ch); |
Howard Hinnant | e51e4e9 | 2011-09-01 21:02:45 +0000 | [diff] [blame] | 1658 | ++__c; |
| 1659 | __is.rdbuf()->sbumpc(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1660 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1661 | __x = bitset<_Size>(__str); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1662 | if (__c == 0) |
| 1663 | __err |= ios_base::failbit; |
| 1664 | __is.setstate(__err); |
| 1665 | } |
| 1666 | else |
| 1667 | __is.setstate(ios_base::failbit); |
| 1668 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1669 | } |
| 1670 | catch (...) |
| 1671 | { |
| 1672 | __is.__set_badbit_and_consider_rethrow(); |
| 1673 | } |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 1674 | #endif // _LIBCPP_NO_EXCEPTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1675 | return __is; |
| 1676 | } |
| 1677 | |
Eric Fiselier | 1b57fa8 | 2016-09-15 22:27:07 +0000 | [diff] [blame] | 1678 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>) |
| 1679 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>) |
| 1680 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1681 | |
| 1682 | _LIBCPP_END_NAMESPACE_STD |
| 1683 | |
| 1684 | #endif // _LIBCPP_ISTREAM |