⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basic_string.h

📁 c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出版社的光盘
💻 H
📖 第 1 页 / 共 3 页
字号:
      void       swap(basic_string<_CharT, _Traits, _Alloc>& __s);      // String operations:      const _CharT*       c_str() const      {	// MT: This assumes concurrent writes are OK.	size_type __n = this->size();	traits_type::assign(_M_data()[__n], _Rep::_S_terminal);        return _M_data();      }      const _CharT*       data() const { return _M_data(); }      allocator_type       get_allocator() const { return _M_dataplus; }      size_type       find(const _CharT* __s, size_type __pos, size_type __n) const;      size_type       find(const basic_string& __str, size_type __pos = 0) const      { return this->find(__str.data(), __pos, __str.size()); }      size_type       find(const _CharT* __s, size_type __pos = 0) const      { return this->find(__s, __pos, traits_type::length(__s)); }      size_type       find(_CharT __c, size_type __pos = 0) const;      size_type       rfind(const basic_string& __str, size_type __pos = npos) const      { return this->rfind(__str.data(), __pos, __str.size()); }      size_type       rfind(const _CharT* __s, size_type __pos, size_type __n) const;      size_type       rfind(const _CharT* __s, size_type __pos = npos) const      { return this->rfind(__s, __pos, traits_type::length(__s)); }      size_type       rfind(_CharT __c, size_type __pos = npos) const;      size_type       find_first_of(const basic_string& __str, size_type __pos = 0) const      { return this->find_first_of(__str.data(), __pos, __str.size()); }      size_type       find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;      size_type       find_first_of(const _CharT* __s, size_type __pos = 0) const      { return this->find_first_of(__s, __pos, traits_type::length(__s)); }      size_type       find_first_of(_CharT __c, size_type __pos = 0) const      { return this->find(__c, __pos); }      size_type       find_last_of(const basic_string& __str, size_type __pos = npos) const      { return this->find_last_of(__str.data(), __pos, __str.size()); }      size_type       find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;      size_type       find_last_of(const _CharT* __s, size_type __pos = npos) const      { return this->find_last_of(__s, __pos, traits_type::length(__s)); }      size_type       find_last_of(_CharT __c, size_type __pos = npos) const      { return this->rfind(__c, __pos); }      size_type       find_first_not_of(const basic_string& __str, size_type __pos = 0) const      { return this->find_first_not_of(__str.data(), __pos, __str.size()); }      size_type       find_first_not_of(const _CharT* __s, size_type __pos, 			size_type __n) const;      size_type       find_first_not_of(const _CharT* __s, size_type __pos = 0) const      { return this->find_first_not_of(__s, __pos, traits_type::length(__s)); }      size_type       find_first_not_of(_CharT __c, size_type __pos = 0) const;      size_type       find_last_not_of(const basic_string& __str, size_type __pos = npos) const      { return this->find_last_not_of(__str.data(), __pos, __str.size()); }      size_type       find_last_not_of(const _CharT* __s, size_type __pos, 		       size_type __n) const;      size_type       find_last_not_of(const _CharT* __s, size_type __pos = npos) const      { return this->find_last_not_of(__s, __pos, traits_type::length(__s)); }      size_type       find_last_not_of(_CharT __c, size_type __pos = npos) const;      basic_string       substr(size_type __pos = 0, size_type __n = npos) const      { 	__OUTOFRANGE(__pos > this->size());	return basic_string(*this, __pos, __n);       }      int       compare(const basic_string& __str) const      {	size_type __size = this->size();	size_type __osize = __str.size();	size_type __len = min(__size, __osize);      	int __r = traits_type::compare(_M_data(), __str.data(), __len);	if (!__r)	  __r =  __size - __osize;	return __r;      }      int       compare(size_type __pos, size_type __n, const basic_string& __str) const;      int       compare(size_type __pos1, size_type __n1, const basic_string& __str,	      size_type __pos2, size_type __n2) const;      int       compare(const _CharT* __s) const;      int       compare(size_type __pos, size_type __n1, const _CharT* __s, 	      size_type __n2 = npos) const;     private:      inline static const _CharT*       _S_find (const _CharT* __beg, const _CharT* __end, _CharT __c);  };  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_string<_CharT, _Traits, _Alloc>::    basic_string()    : _M_dataplus(_S_empty_rep()._M_refcopy(), _Alloc()) { }  // operator +  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_string<_CharT, _Traits, _Alloc>    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)    {      basic_string<_CharT, _Traits, _Alloc> __str(__lhs);      __str.append(__rhs);      return __str;    }  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_string<_CharT, _Traits, _Alloc>    operator+(const _CharT* __lhs,	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)    {      typedef basic_string<_CharT, _Traits, _Alloc> __string_type;      __string_type::size_type __len = _Traits::length(__lhs);      __string_type __str;      __str.reserve(__len + __rhs.size());      __str.append(__lhs, __lhs + __len);      __str.append(__rhs);      return __str;    }  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_string<_CharT, _Traits, _Alloc>    operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)    {      typedef basic_string<_CharT, _Traits, _Alloc> __string_type;      __string_type __str;      __string_type::size_type __len = __rhs.size();      __str.reserve(__len + 1);      __str.append(__string_type::size_type(1), __lhs);      __str.append(__rhs);      return __str;    }  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_string<_CharT, _Traits, _Alloc>    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	     const _CharT* __rhs)    {      basic_string<_CharT, _Traits, _Alloc> __str(__lhs);      __str.append(__rhs);      return __str;    }  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_string<_CharT, _Traits, _Alloc>    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)    {      typedef basic_string<_CharT, _Traits, _Alloc> __string_type;      __string_type __str(__lhs);      __str.append(__string_type::size_type(1), __rhs);      return __str;    }  // operator ==  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __lhs.compare(__rhs) == 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator==(const _CharT* __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __rhs.compare(__lhs) == 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const _CharT* __rhs)    { return __lhs.compare(__rhs) == 0; }  // operator !=  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __rhs.compare(__lhs) != 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator!=(const _CharT* __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __rhs.compare(__lhs) != 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const _CharT* __rhs)    { return __lhs.compare(__rhs) != 0; }  // operator <  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __lhs.compare(__rhs) < 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	      const _CharT* __rhs)    { return __lhs.compare(__rhs) < 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator<(const _CharT* __lhs,	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __rhs.compare(__lhs) > 0; }  // operator >  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __lhs.compare(__rhs) > 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	      const _CharT* __rhs)    { return __lhs.compare(__rhs) > 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator>(const _CharT* __lhs,	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __rhs.compare(__lhs) < 0; }  // operator <=  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __lhs.compare(__rhs) <= 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const _CharT* __rhs)    { return __lhs.compare(__rhs) <= 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator<=(const _CharT* __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)  { return __rhs.compare(__lhs) >= 0; }  // operator >=  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __lhs.compare(__rhs) >= 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,	       const _CharT* __rhs)    { return __lhs.compare(__rhs) >= 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline bool    operator>=(const _CharT* __lhs,	     const basic_string<_CharT, _Traits, _Alloc>& __rhs)    { return __rhs.compare(__lhs) <= 0; }  template<typename _CharT, typename _Traits, typename _Alloc>    inline void    swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,	 basic_string<_CharT, _Traits, _Alloc>& __rhs)    { __lhs.swap(__rhs); }  template<typename _CharT, typename _Traits, typename _Alloc>    basic_istream<_CharT, _Traits>&    operator>>(basic_istream<_CharT, _Traits>& __is,	       basic_string<_CharT, _Traits, _Alloc>& __str);  template<typename _CharT, typename _Traits, typename _Alloc>    basic_ostream<_CharT, _Traits>&    operator<<(basic_ostream<_CharT, _Traits>& __os,	       const basic_string<_CharT, _Traits, _Alloc>& __str);  template<typename _CharT, typename _Traits, typename _Alloc>    basic_istream<_CharT,_Traits>&    getline(basic_istream<_CharT, _Traits>& __is,	    basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);  template<typename _CharT, typename _Traits, typename _Alloc>    inline basic_istream<_CharT,_Traits>&    getline(basic_istream<_CharT, _Traits>& __is,	    basic_string<_CharT, _Traits, _Alloc>& __str);} // namespace std#endif /* _CPP_BITS_STRING_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -