C++的流basic_streambuf

本文介绍了C++标准库中的basic_streambuf类,它是所有C++流的基础,负责管理读写缓冲区。文章详细解释了读写缓冲区的指针布局,并提供了用于设置缓冲区、读写操作以及同步缓冲区的相关成员函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
不是个抽象类,但是他是C++流的基类.它提供了基本的缓冲区管理.它包含六个缓存区指针,三个分别是读指针(开头,结尾,当前),另外三个是写指针(开头,结尾,当前)
 
    读开始指针                            当前读指针                                    读结尾指针
_M_gbegin                          _M_gnext                      _M_gend
         
         =========================================================    
              ^                                                      ^                                              ^
       _M_pbegin                          _M_pnext                      _M_pend
           写开始指针                            当前写指针                           写结尾指针
 
template <class_CharT, class_Traits>
classbasic_streambuf
{
 friendclassbasic_istream<_CharT, _Traits>;
 friendclassbasic_ostream<_CharT, _Traits>;
public:                         // Typedefs.
 typedef_CharT                   char_type;
 typedeftypename_Traits::int_type        int_type;
 typedeftypename_Traits::pos_type     pos_type;
 typedeftypename_Traits::off_type       off_type;
 typedef_Traits                    traits_type;
 
public:                         // Destructor.
 virtual ~basic_streambuf() {}
 
public:                         // Locale-related functions.
 localepubimbue(constlocale& __loc) {
    this->imbue(__loc);
    locale__tmp = _M_locale;
    _M_locale = __loc;
    return__tmp;
 }
 localegetloc() const { return_M_locale; }
 
public:                         // Buffer management.
 //设置缓冲区和长度
 basic_streambuf* pubsetbuf(char_type* __s, streamsize__n)
    { returnthis->setbuf(__s, __n); }
 
 //设置缓冲区偏移量,简单调用seekoff()函数
 pos_typepubseekoff(off_type__offset, ios_base::seekdir__way,
                      ios_base::openmode__mod = ios_base::in | ios_base::out)
    { returnthis->seekoff(__offset, __way, __mod); }
//设置缓冲区位置,简单调用seekpos()函数
 pos_typepubseekpos(pos_type__sp,
                      ios_base::openmode__mod = ios_base::in | ios_base::out)
    { returnthis->seekpos(__sp, __mod); }
 
//放置缓冲区同步,简单调用sync()函数
 intpubsync() { returnthis->sync(); }
 
public:                       
  // 读取字符的公共成员函数 
 
//比较当前指针和结尾指针,如果在结尾之前返回剩下的缓冲区大小.否则调用showmanyc()函数
 streamsizein_avail() {
    return_M_gnext < _M_gend ? _M_gend - _M_gnext : this->showmanyc();
 }
 
 // 移动到下一个字符,并返回下一字符
 int_typesnextc() {
    return_M_gend - _M_gnext > 1 ? _Traits::to_int_type(*++_M_gnext)
                                  : this->_M_snextc_aux();
 }
 
 // 移动到下一个字符,并返回当前字符
 int_typesbumpc() {
    return_M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++)
                              : this->uflow();
 }
 
//并返回当前字符,指针不移动到
 int_typesgetc() {
    return_M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext)
                              : this->underflow();
 }
   
 // 获取n个字符串到参数__s
 streamsizesgetn(char_type* __s, streamsize__n)
    { returnthis->xsgetn(__s, __n); }
 
 // 比较当前前一个字符是否与参数__c相等,相等则返回,移动当前指针当前前一个字符并返回
 int_typesputbackc(char_type__c) {
    return_M_gbegin < _M_gnext && _Traits::eq(__c, *(_M_gnext - 1))
      ? _Traits::to_int_type(*--_M_gnext)
      : this->pbackfail(_Traits::to_int_type(__c));
 }
 
 //移动当前指针当前前一个字符并返回
 int_typesungetc() {
    return_M_gbegin < _M_gnext
      ? _Traits::to_int_type(*--_M_gnext)
      : this->pbackfail();
 }
 
public:                        
// 公共写字符成员函数
 
 // 写入一个字符,
 int_typesputc(char_type__c) {
    return_M_pnext < _M_pend
      ? _Traits::to_int_type(*_M_pnext++ = __c)
      : this->overflow(_Traits::to_int_type(__c));
 }
 
 // 写入长度为n的字串
 streamsizesputn(constchar_type* __s, streamsize__n)
    { returnthis->xsputn(__s, __n); }
 
 // 扩展写n个字符函数
 streamsize_M_sputnc(char_type__c, streamsize__n)
    { returnthis->_M_xsputnc(__c, __n); }
 
public:                        
// 线程安全的锁
 _STL_mutex_lock _M_lock;
 
protected:                     
// 缺省构造函数
 basic_streambuf()
    : _M_gbegin(0), _M_gnext(0), _M_gend(0),
      _M_pbegin(0), _M_pnext(0), _M_pend(0),
      _M_locale()
    {
      _M_lock._M_initialize();
    }
 
protected:                     
// 保护的获取读指针的成员函数
 char_type* eback() const { return_M_gbegin; }  // 开头读指针
 char_type* gptr() const { return_M_gnext; }  // 当前读指针
 char_type* egptr() const { return_M_gend; }   // 结尾读指针
 
 // 将读指针向移动n个字符
 voidgbump(int__n) { _M_gnext += __n; }
 
 // 从新设置读的三个指针
 voidsetg(char_type* __gbegin, char_type* __gnext, char_type* __gend) {
    _M_gbegin = __gbegin;
    _M_gnext = __gnext;
    _M_gend   = __gend;
 }
 
protected:                     
// 保护的获取写指针的成员函数
        
 char_type* pbase() const { return_M_pbegin; } // 开头读指针
 char_type* pptr() const { return_M_pnext; } // 当前读指针
 char_type* epptr() const { return_M_pend; }   // 结尾读指针
 
 // 将写指针向移动n个字符
 voidpbump(int__n) { _M_pnext += __n; }
 
// 从新设置读的三个指针
 voidsetp(char_type* __pbegin, char_type* __pend) {
    _M_pbegin = __pbegin;
    _M_pnext = __pbegin;
    _M_pend   = __pend;
 } 
 
protected:                     
// 本地化虚函数
 virtualvoidimbue(constlocale&) {}
 
protected:                     
// 内存管理虚函数,当前置返回自己this
 virtualbasic_streambuf* setbuf(char_type*, streamsize)
    { returnthis; }
 
 
 // 通过一个整型偏移值,改变流的位置.该函数这里什么读没作,只返回-1,在子类中重载
 virtualpos_typeseekoff(off_type, ios_base::seekdir,
                           ios_base::openmode = ios_base::in | ios_base::out)
    { returnpos_type(-1); }
 
// 通过前面获取流位置,改变流的位置.该函数这里什么读没作,只返回-1,在子类中重载
 virtualpos_type
 seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out)
    { returnpos_type(-1); }
 
 // 同步(刷新).缓冲区.所有的子类中重载
 virtualintsync() { return 0; }
 
protected:                     
 // 返回在在抵达文件结尾更低级可以读取字符数. (-1 是特定值,意味着underflow 将失败.)
// 函数在子类中重载
 virtualstreamsizeshowmanyc()
    { return 0; }
 
 // 读取n的字符. 返回可读取的字符数
 virtualstreamsizexsgetn(char_type* __s, streamsize__n);
 
 // 当没有读取的位置时调用.: gptr() 返回为空时或者gptr() >= egptr().
 virtualint_typeunderflow()
    { return_Traits::eof(); }
 
 // 类似underflow(), 但是使用在unbuffered 输入.
 virtualint_typeuflow() {
    return_Traits::eq_int_type(this->underflow(), _Traits::eof())
      ? _Traits::eof()
      : _Traits::to_int_type(*_M_gnext++);
 }
 
// 当没有放置的位置时调用.: gptr() 返回为空时或者gptr() == eback().
 virtualint_typepbackfail(int_type__c = _Traits::eof())
    { return_Traits::eof(); }
 
protected:              
 // n 字符,返回写的字符数
 virtualstreamsizexsputn(constchar_type* __s, streamsize__n);
 
// 当没有写位置时调用
 virtualint_typeoverflow(int_type = _Traits::eof())
    { return_Traits::eof(); }
 
private:                       
 char_type* _M_gbegin;         // get 区的开始指针
 char_type* _M_gnext;          // get 区的当前指针
 char_type* _M_gend;           // get 区的结尾指针
 
 char_type* _M_pbegin;         // put 区的开始指针
 char_type* _M_pnext;          // put 区的当前指针
 char_type* _M_pend;           // put 区的结尾指针
 
 locale_M_locale;             // The streambuf's locale object
};
 
 
 
||=== Build file: "no target" in "no project" (compiler: unknown) ===| E:\C++\2\main.cpp||In function 'int main()':| E:\C++\2\main.cpp|11|error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>')| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|120|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|120|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|124|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|124|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|131|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|131|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|168|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|168|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|172|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|172|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|175|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|175|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|179|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|179|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|182|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|182|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|186|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|186|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|190|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|190|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|195|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|195|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|199|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|199|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|214|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|214|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|218|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|218|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|222|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|222|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|235|note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|235|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|259|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|259|note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\bits\basic_string.tcc|1465|note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\bits\basic_string.tcc|1465|note: template argument deduction/substitution failed:| E:\C++\2\main.cpp|11|note: couldn't deduce template parameter '_Alloc'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\bits\istream.tcc|931|note: candidate: 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&) [with _CharT = char; _Traits = std::char_traits<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\bits\istream.tcc|931|note: no known conversion for argument 2 from '<unresolved overloaded function type>' to 'char&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|756|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|756|note: template argument deduction/substitution failed:| E:\C++\2\main.cpp|11|note: cannot convert 'std::endl' (type '<unresolved overloaded function type>') to type 'unsigned char&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|761|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|761|note: template argument deduction/substitution failed:| E:\C++\2\main.cpp|11|note: cannot convert 'std::endl' (type '<unresolved overloaded function type>') to type 'signed char&'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|799|note: candidate: 'std::basic_istream<_CharT2, _Traits2>& std::operator>>(std::basic_istream<_CharT2, _Traits2>&, _CharT2*) [with _CharT2 = char; _Traits2 = std::char_traits<char>; _CharT = char; _Traits = std::char_traits<char>]'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|799|note: no known conversion for argument 2 from '<unresolved overloaded function type>' to 'char*'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|803|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|803|note: template argument deduction/substitution failed:| E:\C++\2\main.cpp|11|note: cannot convert 'std::endl' (type '<unresolved overloaded function type>') to type 'unsigned char*'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|808|note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|808|note: template argument deduction/substitution failed:| E:\C++\2\main.cpp|11|note: cannot convert 'std::endl' (type '<unresolved overloaded function type>') to type 'signed char*'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|980|note: candidate: 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&)'| E:\CodeBlocks\MinGW\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\istream|980|note: template argument deduction/substitution failed:| E:\C++\2\main.cpp|11|note: couldn't deduce template parameter '_Tp'| E:\C++\2\main.cpp|12|error: 'class cube' has no member named 'setchang'| E:\C++\2\main.cpp|13|error: 'class cube' has no member named 'getchang'| ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| 是什么意思,怎么解决
最新发布
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值