栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C++ “istream.hpp“

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C++ “istream.hpp“

为了iostream发的。

// Input streams -*- C++ -*-

// Copyright (C) 1997-2021 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// .

//
// ISO C++ 14882: 27.6.1  Input streams
//



#ifndef _GLIBCXX_ISTREAM
#define _GLIBCXX_ISTREAM 1

#pragma GCC system_header

#include 
#include 

namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION

  
  template
    class basic_istream : virtual public basic_ios<_CharT, _Traits>
    {
    public:
      // Types (inherited from basic_ios (27.4.4)):
      typedef _CharT			 		char_type;
      typedef typename _Traits::int_type 		int_type;
      typedef typename _Traits::pos_type 		pos_type;
      typedef typename _Traits::off_type 		off_type;
      typedef _Traits			 		traits_type;

      // Non-standard Types:
      typedef basic_streambuf<_CharT, _Traits> 		__streambuf_type;
      typedef basic_ios<_CharT, _Traits>		__ios_type;
      typedef basic_istream<_CharT, _Traits>		__istream_type;
      typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
 							__num_get_type;
      typedef ctype<_CharT>	      			__ctype_type;

    protected:
      // Data Members:
      
      streamsize 		_M_gcount;

    public:
      
      explicit
      basic_istream(__streambuf_type* __sb)
      : _M_gcount(streamsize(0))
      { this->init(__sb); }

      
      virtual
      ~basic_istream()
      { _M_gcount = streamsize(0); }

      /// Safe prefix/suffix operations.
      class sentry;
      friend class sentry;

      ///@{
      
      __istream_type&
      operator>>(__istream_type& (*__pf)(__istream_type&))
      { return __pf(*this); }

      __istream_type&
      operator>>(__ios_type& (*__pf)(__ios_type&))
      {
	__pf(*this);
	return *this;
      }

      __istream_type&
      operator>>(ios_base& (*__pf)(ios_base&))
      {
	__pf(*this);
	return *this;
      }
      ///@}

      ///@{
      

      ///@{
      
      __istream_type&
      operator>>(bool& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(short& __n);

      __istream_type&
      operator>>(unsigned short& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(int& __n);

      __istream_type&
      operator>>(unsigned int& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(long& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(unsigned long& __n)
      { return _M_extract(__n); }

#ifdef _GLIBCXX_USE_LONG_LONG
      __istream_type&
      operator>>(long long& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(unsigned long long& __n)
      { return _M_extract(__n); }
#endif
      ///@}

      ///@{
      
      __istream_type&
      operator>>(float& __f)
      { return _M_extract(__f); }

      __istream_type&
      operator>>(double& __f)
      { return _M_extract(__f); }

      __istream_type&
      operator>>(long double& __f)
      { return _M_extract(__f); }
      ///@}

      
      __istream_type&
      operator>>(void*& __p)
      { return _M_extract(__p); }

      
      __istream_type&
      operator>>(__streambuf_type* __sb);
      ///@}

      // [27.6.1.3] unformatted input
      
      streamsize
      gcount() const
      { return _M_gcount; }

      ///@{
      

      
      int_type
      get();

      
      __istream_type&
      get(char_type& __c);

      
      __istream_type&
      get(char_type* __s, streamsize __n, char_type __delim);

      
      __istream_type&
      get(char_type* __s, streamsize __n)
      { return this->get(__s, __n, this->widen('n')); }

      
      __istream_type&
      get(__streambuf_type& __sb, char_type __delim);

      
      __istream_type&
      get(__streambuf_type& __sb)
      { return this->get(__sb, this->widen('n')); }

      
      __istream_type&
      getline(char_type* __s, streamsize __n, char_type __delim);

      
      __istream_type&
      getline(char_type* __s, streamsize __n)
      { return this->getline(__s, __n, this->widen('n')); }

      
      __istream_type&
      ignore(streamsize __n, int_type __delim);

      __istream_type&
      ignore(streamsize __n);

      __istream_type&
      ignore();

      
      int_type
      peek();

      
      __istream_type&
      read(char_type* __s, streamsize __n);

      
      streamsize
      readsome(char_type* __s, streamsize __n);

      
      __istream_type&
      putback(char_type __c);

      
      __istream_type&
      unget();

      
      int
      sync();

      
      pos_type
      tellg();

      
      __istream_type&
      seekg(pos_type);

      
      __istream_type&
      seekg(off_type, ios_base::seekdir);
      ///@}

    protected:
      basic_istream()
      : _M_gcount(streamsize(0))
      { this->init(0); }

#if __cplusplus >= 201103L
      basic_istream(const basic_istream&) = delete;

      basic_istream(basic_istream&& __rhs)
      : __ios_type(), _M_gcount(__rhs._M_gcount)
      {
	__ios_type::move(__rhs);
	__rhs._M_gcount = 0;
      }

      // 27.7.3.3 Assign/swap

      basic_istream& operator=(const basic_istream&) = delete;

      basic_istream&
      operator=(basic_istream&& __rhs)
      {
	swap(__rhs);
	return *this;
      }

      void
      swap(basic_istream& __rhs)
      {
	__ios_type::swap(__rhs);
	std::swap(_M_gcount, __rhs._M_gcount);
      }
#endif

      template
	__istream_type&
	_M_extract(_ValueT& __v);
    };

  /// Explicit specialization declarations, defined in src/istream.cc.
  template<>
    basic_istream&
    basic_istream::
    getline(char_type* __s, streamsize __n, char_type __delim);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n, int_type __delim);

#ifdef _GLIBCXX_USE_WCHAR_T
  template<>
    basic_istream&
    basic_istream::
    getline(char_type* __s, streamsize __n, char_type __delim);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n, int_type __delim);
#endif

  
  template
    class basic_istream<_CharT, _Traits>::sentry
    {
      // Data Members.
      bool _M_ok;

    public:
      /// Easy access to dependent types.
      typedef _Traits 					traits_type;
      typedef basic_streambuf<_CharT, _Traits> 		__streambuf_type;
      typedef basic_istream<_CharT, _Traits> 		__istream_type;
      typedef typename __istream_type::__ctype_type 	__ctype_type;
      typedef typename _Traits::int_type		__int_type;

      
      explicit
      sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);

      
#if __cplusplus >= 201103L
      explicit
#endif
      operator bool() const
      { return _M_ok; }
    };

  ///@{
  
  template
    basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>& ___in, _CharT& __c);

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, unsigned char& __c)
    { return (___in >> reinterpret_cast(__c)); }

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, signed char& __c)
    { return (___in >> reinterpret_cast(__c)); }
  ///@}


  template
    void
    __istream_extract(basic_istream<_CharT, _Traits>&, _CharT*, streamsize);

  void __istream_extract(istream&, char*, streamsize);

  ///@{
  

#if __cplusplus <= 201703L
  template
    __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
    inline basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>& ___in, _CharT* __s)
    {
      size_t __n = __builtin_object_size(__s, 0);
      if (__builtin_expect(__n < sizeof(_CharT), false))
	{
	  // There is not even space for the required null terminator.
	  __glibcxx_assert(__n >= sizeof(_CharT));
	  ___in.width(0);
	  ___in.setstate(ios_base::failbit);
	}
      else
	{
	  if (__n == (size_t)-1)
	    __n = __gnu_cxx::__numeric_traits::__max;
	  std::__istream_extract(___in, __s, __n / sizeof(_CharT));
	}
      return ___in;
    }

  template
    __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
    inline basic_istream&
    operator>>(basic_istream& ___in, unsigned char* __s)
    { return ___in >> reinterpret_cast(__s); }

  template
    __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
    inline basic_istream&
    operator>>(basic_istream& ___in, signed char* __s)
    { return ___in >> reinterpret_cast(__s); }
#else
  // _GLIBCXX_RESOLVE_LIB_DEFECTS
  // 2499. operator>>(istream&, char*) makes it hard to avoid buffer overflows
  template
    inline basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>& ___in, _CharT (&__s)[_Num])
    {
      static_assert(_Num <= __gnu_cxx::__numeric_traits::__max);
      std::__istream_extract(___in, __s, _Num);
      return ___in;
    }

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, unsigned char (&__s)[_Num])
    { return ___in >> reinterpret_cast(__s); }

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, signed char (&__s)[_Num])
    { return ___in >> reinterpret_cast(__s); }
#endif
  ///@}

  
  template
    class basic_iostream
    : public basic_istream<_CharT, _Traits>,
      public basic_ostream<_CharT, _Traits>
    {
    public:
      // _GLIBCXX_RESOLVE_LIB_DEFECTS
      // 271. basic_iostream missing typedefs
      // Types (inherited):
      typedef _CharT			 		char_type;
      typedef typename _Traits::int_type 		int_type;
      typedef typename _Traits::pos_type 		pos_type;
      typedef typename _Traits::off_type 		off_type;
      typedef _Traits			 		traits_type;

      // Non-standard Types:
      typedef basic_istream<_CharT, _Traits>		__istream_type;
      typedef basic_ostream<_CharT, _Traits>		__ostream_type;

      
      explicit
      basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
      : __istream_type(__sb), __ostream_type(__sb) { }

      
      virtual
      ~basic_iostream() { }

    protected:
      basic_iostream()
      : __istream_type(), __ostream_type() { }

#if __cplusplus >= 201103L
      basic_iostream(const basic_iostream&) = delete;

      basic_iostream(basic_iostream&& __rhs)
      : __istream_type(std::move(__rhs)), __ostream_type(*this)
      { }

      // 27.7.3.3 Assign/swap

      basic_iostream& operator=(const basic_iostream&) = delete;

      basic_iostream&
      operator=(basic_iostream&& __rhs)
      {
	swap(__rhs);
	return *this;
      }

      void
      swap(basic_iostream& __rhs)
      { __istream_type::swap(__rhs); }
#endif
    };

  
  template
    basic_istream<_CharT, _Traits>&
    ws(basic_istream<_CharT, _Traits>& __is);

#if __cplusplus >= 201103L
  // C++11 27.7.2.6 Rvalue stream extraction [istream.rvalue]
  // _GLIBCXX_RESOLVE_LIB_DEFECTS
  // 2328. Rvalue stream extraction should use perfect forwarding
  // 1203. More useful rvalue stream insertion

#if __cpp_lib_concepts
  template
    requires __derived_from_ios_base<_Is>
      && requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); }
    using __rvalue_stream_extraction_t = _Is&&;
#else
  template,
	   typename = decltype(std::declval<_Is&>() >> std::declval<_Tp>())>
    using __rvalue_stream_extraction_t = _Is&&;
#endif

  
  template
    inline __rvalue_stream_extraction_t<_Istream, _Tp>
    operator>>(_Istream&& __is, _Tp&& __x)
    {
      __is >> std::forward<_Tp>(__x);
      return std::move(__is);
    }
#endif // C++11

_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

#include 

#endif	

原文如下:

// Input streams -*- C++ -*-

// Copyright (C) 1997-2021 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// .

//
// ISO C++ 14882: 27.6.1  Input streams
//



#ifndef _GLIBCXX_ISTREAM
#define _GLIBCXX_ISTREAM 1

#pragma GCC system_header

#include 
#include 

namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION

  
  template
    class basic_istream : virtual public basic_ios<_CharT, _Traits>
    {
    public:
      // Types (inherited from basic_ios (27.4.4)):
      typedef _CharT               char_type;
      typedef typename _Traits::int_type      int_type;
      typedef typename _Traits::pos_type      pos_type;
      typedef typename _Traits::off_type      off_type;
      typedef _Traits              traits_type;

      // Non-standard Types:
      typedef basic_streambuf<_CharT, _Traits>        __streambuf_type;
      typedef basic_ios<_CharT, _Traits>      __ios_type;
      typedef basic_istream<_CharT, _Traits>      __istream_type;
      typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
                     __num_get_type;
      typedef ctype<_CharT>                 __ctype_type;

    protected:
      // Data Members:
      
      streamsize      _M_gcount;

    public:
      
      explicit
      basic_istream(__streambuf_type* __sb)
      : _M_gcount(streamsize(0))
      { this->init(__sb); }

      
      virtual
      ~basic_istream()
      { _M_gcount = streamsize(0); }

      /// Safe prefix/suffix operations.
      class sentry;
      friend class sentry;

      ///@{
      
      __istream_type&
      operator>>(__istream_type& (*__pf)(__istream_type&))
      { return __pf(*this); }

      __istream_type&
      operator>>(__ios_type& (*__pf)(__ios_type&))
      {
   __pf(*this);
   return *this;
      }

      __istream_type&
      operator>>(ios_base& (*__pf)(ios_base&))
      {
   __pf(*this);
   return *this;
      }
      ///@}

      ///@{
      

      ///@{
      
      __istream_type&
      operator>>(bool& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(short& __n);

      __istream_type&
      operator>>(unsigned short& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(int& __n);

      __istream_type&
      operator>>(unsigned int& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(long& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(unsigned long& __n)
      { return _M_extract(__n); }

#ifdef _GLIBCXX_USE_LONG_LONG
      __istream_type&
      operator>>(long long& __n)
      { return _M_extract(__n); }

      __istream_type&
      operator>>(unsigned long long& __n)
      { return _M_extract(__n); }
#endif
      ///@}

      ///@{
      
      __istream_type&
      operator>>(float& __f)
      { return _M_extract(__f); }

      __istream_type&
      operator>>(double& __f)
      { return _M_extract(__f); }

      __istream_type&
      operator>>(long double& __f)
      { return _M_extract(__f); }
      ///@}

      
      __istream_type&
      operator>>(void*& __p)
      { return _M_extract(__p); }

      
      __istream_type&
      operator>>(__streambuf_type* __sb);
      ///@}

      // [27.6.1.3] unformatted input
      
      streamsize
      gcount() const
      { return _M_gcount; }

      ///@{
      

      
      int_type
      get();

      
      __istream_type&
      get(char_type& __c);

      
      __istream_type&
      get(char_type* __s, streamsize __n, char_type __delim);

      
      __istream_type&
      get(char_type* __s, streamsize __n)
      { return this->get(__s, __n, this->widen('n')); }

      
      __istream_type&
      get(__streambuf_type& __sb, char_type __delim);

      
      __istream_type&
      get(__streambuf_type& __sb)
      { return this->get(__sb, this->widen('n')); }

      
      __istream_type&
      getline(char_type* __s, streamsize __n, char_type __delim);

      
      __istream_type&
      getline(char_type* __s, streamsize __n)
      { return this->getline(__s, __n, this->widen('n')); }

      
      __istream_type&
      ignore(streamsize __n, int_type __delim);

      __istream_type&
      ignore(streamsize __n);

      __istream_type&
      ignore();

      
      int_type
      peek();

      
      __istream_type&
      read(char_type* __s, streamsize __n);

      
      streamsize
      readsome(char_type* __s, streamsize __n);

      
      __istream_type&
      putback(char_type __c);

      
      __istream_type&
      unget();

      
      int
      sync();

      
      pos_type
      tellg();

      
      __istream_type&
      seekg(pos_type);

      
      __istream_type&
      seekg(off_type, ios_base::seekdir);
      ///@}

    protected:
      basic_istream()
      : _M_gcount(streamsize(0))
      { this->init(0); }

#if __cplusplus >= 201103L
      basic_istream(const basic_istream&) = delete;

      basic_istream(basic_istream&& __rhs)
      : __ios_type(), _M_gcount(__rhs._M_gcount)
      {
   __ios_type::move(__rhs);
   __rhs._M_gcount = 0;
      }

      // 27.7.3.3 Assign/swap

      basic_istream& operator=(const basic_istream&) = delete;

      basic_istream&
      operator=(basic_istream&& __rhs)
      {
   swap(__rhs);
   return *this;
      }

      void
      swap(basic_istream& __rhs)
      {
   __ios_type::swap(__rhs);
   std::swap(_M_gcount, __rhs._M_gcount);
      }
#endif

      template
   __istream_type&
   _M_extract(_ValueT& __v);
    };

  /// Explicit specialization declarations, defined in src/istream.cc.
  template<>
    basic_istream&
    basic_istream::
    getline(char_type* __s, streamsize __n, char_type __delim);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n, int_type __delim);

#ifdef _GLIBCXX_USE_WCHAR_T
  template<>
    basic_istream&
    basic_istream::
    getline(char_type* __s, streamsize __n, char_type __delim);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n);

  template<>
    basic_istream&
    basic_istream::
    ignore(streamsize __n, int_type __delim);
#endif

  
  template
    class basic_istream<_CharT, _Traits>::sentry
    {
      // Data Members.
      bool _M_ok;

    public:
      /// Easy access to dependent types.
      typedef _Traits              traits_type;
      typedef basic_streambuf<_CharT, _Traits>        __streambuf_type;
      typedef basic_istream<_CharT, _Traits>      __istream_type;
      typedef typename __istream_type::__ctype_type    __ctype_type;
      typedef typename _Traits::int_type      __int_type;

      
      explicit
      sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);

      
#if __cplusplus >= 201103L
      explicit
#endif
      operator bool() const
      { return _M_ok; }
    };

  ///@{
  
  template
    basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>& ___in, _CharT& __c);

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, unsigned char& __c)
    { return (___in >> reinterpret_cast(__c)); }

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, signed char& __c)
    { return (___in >> reinterpret_cast(__c)); }
  ///@}


  template
    void
    __istream_extract(basic_istream<_CharT, _Traits>&, _CharT*, streamsize);

  void __istream_extract(istream&, char*, streamsize);

  ///@{
  

#if __cplusplus <= 201703L
  template
    __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
    inline basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>& ___in, _CharT* __s)
    {
      size_t __n = __builtin_object_size(__s, 0);
      if (__builtin_expect(__n < sizeof(_CharT), false))
   {
     // There is not even space for the required null terminator.
     __glibcxx_assert(__n >= sizeof(_CharT));
     ___in.width(0);
     ___in.setstate(ios_base::failbit);
   }
      else
   {
     if (__n == (size_t)-1)
       __n = __gnu_cxx::__numeric_traits::__max;
     std::__istream_extract(___in, __s, __n / sizeof(_CharT));
   }
      return ___in;
    }

  template
    __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
    inline basic_istream&
    operator>>(basic_istream& ___in, unsigned char* __s)
    { return ___in >> reinterpret_cast(__s); }

  template
    __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
    inline basic_istream&
    operator>>(basic_istream& ___in, signed char* __s)
    { return ___in >> reinterpret_cast(__s); }
#else
  // _GLIBCXX_RESOLVE_LIB_DEFECTS
  // 2499. operator>>(istream&, char*) makes it hard to avoid buffer overflows
  template
    inline basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>& ___in, _CharT (&__s)[_Num])
    {
      static_assert(_Num <= __gnu_cxx::__numeric_traits::__max);
      std::__istream_extract(___in, __s, _Num);
      return ___in;
    }

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, unsigned char (&__s)[_Num])
    { return ___in >> reinterpret_cast(__s); }

  template
    inline basic_istream&
    operator>>(basic_istream& ___in, signed char (&__s)[_Num])
    { return ___in >> reinterpret_cast(__s); }
#endif
  ///@}

  
  template
    class basic_iostream
    : public basic_istream<_CharT, _Traits>,
      public basic_ostream<_CharT, _Traits>
    {
    public:
      // _GLIBCXX_RESOLVE_LIB_DEFECTS
      // 271. basic_iostream missing typedefs
      // Types (inherited):
      typedef _CharT               char_type;
      typedef typename _Traits::int_type      int_type;
      typedef typename _Traits::pos_type      pos_type;
      typedef typename _Traits::off_type      off_type;
      typedef _Traits              traits_type;

      // Non-standard Types:
      typedef basic_istream<_CharT, _Traits>      __istream_type;
      typedef basic_ostream<_CharT, _Traits>      __ostream_type;

      
      explicit
      basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
      : __istream_type(__sb), __ostream_type(__sb) { }

      
      virtual
      ~basic_iostream() { }

    protected:
      basic_iostream()
      : __istream_type(), __ostream_type() { }

#if __cplusplus >= 201103L
      basic_iostream(const basic_iostream&) = delete;

      basic_iostream(basic_iostream&& __rhs)
      : __istream_type(std::move(__rhs)), __ostream_type(*this)
      { }

      // 27.7.3.3 Assign/swap

      basic_iostream& operator=(const basic_iostream&) = delete;

      basic_iostream&
      operator=(basic_iostream&& __rhs)
      {
   swap(__rhs);
   return *this;
      }

      void
      swap(basic_iostream& __rhs)
      { __istream_type::swap(__rhs); }
#endif
    };

  
  template
    basic_istream<_CharT, _Traits>&
    ws(basic_istream<_CharT, _Traits>& __is);

#if __cplusplus >= 201103L
  // C++11 27.7.2.6 Rvalue stream extraction [istream.rvalue]
  // _GLIBCXX_RESOLVE_LIB_DEFECTS
  // 2328. Rvalue stream extraction should use perfect forwarding
  // 1203. More useful rvalue stream insertion

#if __cpp_lib_concepts
  template
    requires __derived_from_ios_base<_Is>
      && requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); }
    using __rvalue_stream_extraction_t = _Is&&;
#else
  template,
      typename = decltype(std::declval<_Is&>() >> std::declval<_Tp>())>
    using __rvalue_stream_extraction_t = _Is&&;
#endif

  
  template
    inline __rvalue_stream_extraction_t<_Istream, _Tp>
    operator>>(_Istream&& __is, _Tp&& __x)
    {
      __is >> std::forward<_Tp>(__x);
      return std::move(__is);
    }
#endif // C++11

_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

#include 

#endif 
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/954603.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号