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

📄 vstring.h

📁 linux下编程用 编译软件
💻 H
📖 第 1 页 / 共 5 页
字号:
       *  @brief  Replace characters with multiple characters.       *  @param pos  Index of first character to replace.       *  @param n1  Number of characters to be replaced.       *  @param n2  Number of characters to insert.       *  @param c  Character to insert.       *  @return  Reference to this string.       *  @throw  std::out_of_range  If @a pos > size().       *  @throw  std::length_error  If new length exceeds @c max_size().       *       *  Removes the characters in the range [pos,pos + n1) from this string.       *  In place, @a n2 copies of @a c are inserted.  If @a pos is beyond       *  end of string, out_of_range is thrown.  If the length of result       *  exceeds max_size(), length_error is thrown.  The value of the string       *  doesn't change if an error is thrown.      */      __versa_string&      replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)      { return _M_replace_aux(_M_check(__pos, "__versa_string::replace"),			      _M_limit(__pos, __n1), __n2, __c); }      /**       *  @brief  Replace range of characters with string.       *  @param i1  Iterator referencing start of range to replace.       *  @param i2  Iterator referencing end of range to replace.       *  @param str  String value to insert.       *  @return  Reference to this string.       *  @throw  std::length_error  If new length exceeds @c max_size().       *       *  Removes the characters in the range [i1,i2).  In place, the value of       *  @a str is inserted.  If the length of result exceeds max_size(),       *  length_error is thrown.  The value of the string doesn't change if       *  an error is thrown.      */      __versa_string&      replace(iterator __i1, iterator __i2, const __versa_string& __str)      { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }      /**       *  @brief  Replace range of characters with C substring.       *  @param i1  Iterator referencing start of range to replace.       *  @param i2  Iterator referencing end of range to replace.       *  @param s  C string value to insert.       *  @param n  Number of characters from s to insert.       *  @return  Reference to this string.       *  @throw  std::length_error  If new length exceeds @c max_size().       *       *  Removes the characters in the range [i1,i2).  In place, the first @a       *  n characters of @a s are inserted.  If the length of result exceeds       *  max_size(), length_error is thrown.  The value of the string doesn't       *  change if an error is thrown.      */      __versa_string&      replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)      {	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				 && __i2 <= _M_iend());	return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);      }      /**       *  @brief  Replace range of characters with C string.       *  @param i1  Iterator referencing start of range to replace.       *  @param i2  Iterator referencing end of range to replace.       *  @param s  C string value to insert.       *  @return  Reference to this string.       *  @throw  std::length_error  If new length exceeds @c max_size().       *       *  Removes the characters in the range [i1,i2).  In place, the       *  characters of @a s are inserted.  If the length of result exceeds       *  max_size(), length_error is thrown.  The value of the string doesn't       *  change if an error is thrown.      */      __versa_string&      replace(iterator __i1, iterator __i2, const _CharT* __s)      {	__glibcxx_requires_string(__s);	return this->replace(__i1, __i2, __s, traits_type::length(__s));      }      /**       *  @brief  Replace range of characters with multiple characters       *  @param i1  Iterator referencing start of range to replace.       *  @param i2  Iterator referencing end of range to replace.       *  @param n  Number of characters to insert.       *  @param c  Character to insert.       *  @return  Reference to this string.       *  @throw  std::length_error  If new length exceeds @c max_size().       *       *  Removes the characters in the range [i1,i2).  In place, @a n copies       *  of @a c are inserted.  If the length of result exceeds max_size(),       *  length_error is thrown.  The value of the string doesn't change if       *  an error is thrown.      */      __versa_string&      replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)      {	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				 && __i2 <= _M_iend());	return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);      }      /**       *  @brief  Replace range of characters with range.       *  @param i1  Iterator referencing start of range to replace.       *  @param i2  Iterator referencing end of range to replace.       *  @param k1  Iterator referencing start of range to insert.       *  @param k2  Iterator referencing end of range to insert.       *  @return  Reference to this string.       *  @throw  std::length_error  If new length exceeds @c max_size().       *       *  Removes the characters in the range [i1,i2).  In place, characters       *  in the range [k1,k2) are inserted.  If the length of result exceeds       *  max_size(), length_error is thrown.  The value of the string doesn't       *  change if an error is thrown.      */      template<class _InputIterator>        __versa_string&        replace(iterator __i1, iterator __i2,		_InputIterator __k1, _InputIterator __k2)        {	  _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				   && __i2 <= _M_iend());	  __glibcxx_requires_valid_range(__k1, __k2);	  typedef typename std::__is_integer<_InputIterator>::__type _Integral;	  return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());	}      // Specializations for the common case of pointer and iterator:      // useful to avoid the overhead of temporary buffering in _M_replace.      __versa_string&      replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)      {	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				 && __i2 <= _M_iend());	__glibcxx_requires_valid_range(__k1, __k2);	return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			     __k1, __k2 - __k1);      }      __versa_string&      replace(iterator __i1, iterator __i2,	      const _CharT* __k1, const _CharT* __k2)      {	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				 && __i2 <= _M_iend());	__glibcxx_requires_valid_range(__k1, __k2);	return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			     __k1, __k2 - __k1);      }      __versa_string&      replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)      {	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				 && __i2 <= _M_iend());	__glibcxx_requires_valid_range(__k1, __k2);	return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			     __k1.base(), __k2 - __k1);      }      __versa_string&      replace(iterator __i1, iterator __i2,	      const_iterator __k1, const_iterator __k2)      {	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2				 && __i2 <= _M_iend());	__glibcxx_requires_valid_range(__k1, __k2);	return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			     __k1.base(), __k2 - __k1);      }          private:      template<class _Integer>	__versa_string&	_M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,			    _Integer __val, __true_type)        { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }      template<class _InputIterator>	__versa_string&	_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,			    _InputIterator __k2, __false_type);      __versa_string&      _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,		     _CharT __c);      __versa_string&      _M_replace(size_type __pos, size_type __len1, const _CharT* __s,		 const size_type __len2);      __versa_string&      _M_append(const _CharT* __s, size_type __n);    public:      /**       *  @brief  Copy substring into C string.       *  @param s  C string to copy value into.       *  @param n  Number of characters to copy.       *  @param pos  Index of first character to copy.       *  @return  Number of characters actually copied       *  @throw  std::out_of_range  If pos > size().       *       *  Copies up to @a n characters starting at @a pos into the C string @a       *  s.  If @a pos is greater than size(), out_of_range is thrown.      */      size_type      copy(_CharT* __s, size_type __n, size_type __pos = 0) const;      /**       *  @brief  Swap contents with another string.       *  @param s  String to swap with.       *       *  Exchanges the contents of this string with that of @a s in constant       *  time.      */      void      swap(__versa_string& __s)      { this->_M_swap(__s); }      // String operations:      /**       *  @brief  Return const pointer to null-terminated contents.       *       *  This is a handle to internal data.  Do not modify or dire things may       *  happen.      */      const _CharT*      c_str() const      { return this->_M_data(); }      /**       *  @brief  Return const pointer to contents.       *       *  This is a handle to internal data.  Do not modify or dire things may       *  happen.      */      const _CharT*      data() const      { return this->_M_data(); }      /**       *  @brief  Return copy of allocator used to construct this string.      */      allocator_type      get_allocator() const      { return this->_M_get_allocator(); }      /**       *  @brief  Find position of a C substring.       *  @param s  C string to locate.       *  @param pos  Index of character to search from.       *  @param n  Number of characters from @a s to search for.       *  @return  Index of start of first occurrence.       *       *  Starting from @a pos, searches forward for the first @a n characters       *  in @a s within this string.  If found, returns the index where it       *  begins.  If not found, returns npos.      */      size_type      find(const _CharT* __s, size_type __pos, size_type __n) const;      /**       *  @brief  Find position of a string.       *  @param str  String to locate.       *  @param pos  Index of character to search from (default 0).       *  @return  Index of start of first occurrence.       *       *  Starting from @a pos, searches forward for value of @a str within       *  this string.  If found, returns the index where it begins.  If not       *  found, returns npos.      */      size_type      find(const __versa_string& __str, size_type __pos = 0) const      { return this->find(__str.data(), __pos, __str.size()); }      /**       *  @brief  Find position of a C string.       *  @param s  C string to locate.       *  @param pos  Index of character to search from (default 0).       *  @return  Index of start of first occurrence.       *       *  Starting from @a pos, searches forward for the value of @a s within       *  this string.  If found, returns the index where it begins.  If not       *  found, returns npos.      */      size_type      find(const _CharT* __s, size_type __pos = 0) const      {	__glibcxx_requires_string(__s);	return this->find(__s, __pos, traits_type::length(__s));      }      /**       *  @brief  Find position of a character.       *  @param c  Character to locate.       *  @param pos  Index of character to search from (default 0).       *  @return  Index of first occurrence.       *       *  Starting from @a pos, searches forward for @a c within this string.       *  If found, returns the index where it was found.  If not found,       *  returns npos.      */      size_type      find(_CharT __c, size_type __pos = 0) const;      /**       *  @brief  Find last position of a string.       *  @param str  String to locate.       *  @param pos  Index of character to search back from (default end).       *  @return  Index of start of last occurrence.       *       *  Starting from @a pos, searches backward for value of @a str within       *  this string.  If found, returns the index where it begins.  If not       *  found, returns npos.      */      size_type      rfind(const __versa_string& __str, size_type __pos = npos) const      { return this->rfind(__str.data(), __pos, __str.size()); }      /**       *  @brief  Find last position of a C substring.       *  @param s  C string to locate.       *  @param pos  Index of character to search back from.       *  @param n  Number of characters from s to search for.       *  @return  Index of start of last occurrence.       *       *  Starting from @a pos, searches backward for the first @a n       *  characters in @a s within this string.  If found, returns the index       *  where it begins.  If not found, returns npos.      */      size_type      rfind(const _CharT* __s, size_type __pos, size_type __n) const;      /**       *  @brief  Find last position of a C string.       *  @param s  C string to locate.       *  @param pos  Index of character to start search at (default 0).       *  @return  Index of start of  last occurrence.       *       *  Starting from @a pos, searches backward for the value of @a s within

⌨️ 快捷键说明

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