@@ -228,7 +228,7 @@ public:
228228 basic_istream& operator =(const basic_istream& __rhs) = delete ;
229229
230230 // 27.7.1.1.3 Prefix/suffix:
231- class sentry ;
231+ class _LIBCPP_EXPORTED_FROM_ABI sentry;
232232
233233 // 27.7.1.2 Formatted input:
234234 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator >>(basic_istream& (*__pf)(basic_istream&)) {
@@ -309,36 +309,33 @@ class basic_istream<_CharT, _Traits>::sentry {
309309 bool __ok_;
310310
311311public:
312- explicit sentry (basic_istream<_CharT, _Traits>& __is, bool __noskipws = false );
312+ explicit inline sentry (basic_istream<_CharT, _Traits>& __is, bool __noskipws = false ) : __ok_(false ) {
313+ if (__is.good ()) {
314+ if (__is.tie ())
315+ __is.tie ()->flush ();
316+ if (!__noskipws && (__is.flags () & ios_base::skipws)) {
317+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
318+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc ());
319+ _Ip __i (__is);
320+ _Ip __eof;
321+ for (; __i != __eof; ++__i)
322+ if (!__ct.is (__ct.space , *__i))
323+ break ;
324+ if (__i == __eof)
325+ __is.setstate (ios_base::failbit | ios_base::eofbit);
326+ }
327+ __ok_ = __is.good ();
328+ } else
329+ __is.setstate (ios_base::failbit);
330+ }
313331 // ~sentry() = default;
314332
315- _LIBCPP_HIDE_FROM_ABI explicit operator bool () const { return __ok_; }
333+ _LIBCPP_HIDE_FROM_ABI explicit inline operator bool () const { return __ok_; }
316334
317335 sentry (const sentry&) = delete ;
318336 sentry& operator =(const sentry&) = delete ;
319337};
320338
321- template <class _CharT , class _Traits >
322- basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws) : __ok_(false ) {
323- if (__is.good ()) {
324- if (__is.tie ())
325- __is.tie ()->flush ();
326- if (!__noskipws && (__is.flags () & ios_base::skipws)) {
327- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
328- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc ());
329- _Ip __i (__is);
330- _Ip __eof;
331- for (; __i != __eof; ++__i)
332- if (!__ct.is (__ct.space , *__i))
333- break ;
334- if (__i == __eof)
335- __is.setstate (ios_base::failbit | ios_base::eofbit);
336- }
337- __ok_ = __is.good ();
338- } else
339- __is.setstate (ios_base::failbit);
340- }
341-
342339template <class _CharT , class _Traits >
343340basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) : __gc_(__rhs.__gc_) {
344341 __rhs.__gc_ = 0 ;
0 commit comments