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

📄 basic_string.h

📁 俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)的全部源代码。
💻 H
📖 第 1 页 / 共 3 页
字号:
        basic_string(_InputIterator __beg, _InputIterator __end,		     const _Alloc& __a = _Alloc());      ~basic_string()      { _M_rep()->_M_dispose(this->get_allocator()); }      basic_string&      operator=(const basic_string& __str) { return this->assign(__str); }      basic_string&      operator=(const _CharT* __s) { return this->assign(__s); }      basic_string&      operator=(_CharT __c) { return this->assign(1, __c); }      // Iterators:      iterator      begin()      {	_M_leak();	return iterator(_M_data());      }      const_iterator      begin() const      { return const_iterator(_M_data()); }      iterator      end()      {         _M_leak();	 return iterator(_M_data() + this->size());      }      const_iterator      end() const      { return const_iterator(_M_data() + this->size()); }      reverse_iterator      rbegin()      { return reverse_iterator(this->end()); }      const_reverse_iterator      rbegin() const      { return const_reverse_iterator(this->end()); }      reverse_iterator      rend()      { return reverse_iterator(this->begin()); }      const_reverse_iterator      rend() const      { return const_reverse_iterator(this->begin()); }    public:      // Capacity:      size_type      size() const { return _M_rep()->_M_length; }      size_type      length() const { return _M_rep()->_M_length; }      size_type      max_size() const { return _Rep::_S_max_size; }      void      resize(size_type __n, _CharT __c);      void      resize(size_type __n) { this->resize(__n, _CharT()); }      size_type      capacity() const { return _M_rep()->_M_capacity; }      void      reserve(size_type __res_arg = 0);      void      clear() { _M_mutate(0, this->size(), 0); }      bool      empty() const { return this->size() == 0; }      // Element access:      const_reference      operator[] (size_type __pos) const      { return _M_data()[__pos]; }      reference      operator[](size_type __pos)      {	_M_leak();	return _M_data()[__pos];      }      const_reference      at(size_type __n) const      {	if (__n >= this->size())	  __throw_out_of_range("basic_string::at");	return _M_data()[__n];      }      reference      at(size_type __n)      {	if (__n >= size())	  __throw_out_of_range("basic_string::at");	_M_leak();	return _M_data()[__n];      }      // Modifiers:      basic_string&      operator+=(const basic_string& __str) { return this->append(__str); }      basic_string&      operator+=(const _CharT* __s) { return this->append(__s); }      basic_string&      operator+=(_CharT __c) { return this->append(size_type(1), __c); }      basic_string&      append(const basic_string& __str);      basic_string&      append(const basic_string& __str, size_type __pos, size_type __n);      basic_string&      append(const _CharT* __s, size_type __n);      basic_string&      append(const _CharT* __s)      { return this->append(__s, traits_type::length(__s)); }      basic_string&      append(size_type __n, _CharT __c);      template<class _InputIterator>        basic_string&        append(_InputIterator __first, _InputIterator __last)        { return this->replace(_M_iend(), _M_iend(), __first, __last); }      void      push_back(_CharT __c)      { this->replace(_M_iend(), _M_iend(), 1, __c); }      basic_string&      assign(const basic_string& __str);      basic_string&      assign(const basic_string& __str, size_type __pos, size_type __n);      basic_string&      assign(const _CharT* __s, size_type __n);      basic_string&      assign(const _CharT* __s)      { return this->assign(__s, traits_type::length(__s)); }      basic_string&      assign(size_type __n, _CharT __c)      { return this->replace(_M_ibegin(), _M_iend(), __n, __c); }      template<class _InputIterator>        basic_string&        assign(_InputIterator __first, _InputIterator __last)        { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }      void      insert(iterator __p, size_type __n, _CharT __c)      {	this->replace(__p, __p, __n, __c);  }      template<class _InputIterator>        void insert(iterator __p, _InputIterator __beg, _InputIterator __end)        { this->replace(__p, __p, __beg, __end); }      basic_string&      insert(size_type __pos1, const basic_string& __str)      { return this->insert(__pos1, __str, 0, __str.size()); }      basic_string&      insert(size_type __pos1, const basic_string& __str,	     size_type __pos2, size_type __n);      basic_string&      insert(size_type __pos, const _CharT* __s, size_type __n);      basic_string&      insert(size_type __pos, const _CharT* __s)      { return this->insert(__pos, __s, traits_type::length(__s)); }      basic_string&      insert(size_type __pos, size_type __n, _CharT __c)      {	this->insert(_M_check(__pos), __n, __c);	return *this;      }      iterator      insert(iterator __p, _CharT __c = _CharT())      {	size_type __pos = __p - _M_ibegin();	this->insert(_M_check(__pos), size_type(1), __c);	_M_rep()->_M_set_leaked(); 	return this->_M_ibegin() + __pos;      }      basic_string&      erase(size_type __pos = 0, size_type __n = npos)      {	return this->replace(_M_check(__pos), _M_fold(__pos, __n),			     _M_data(), _M_data());      }      iterator      erase(iterator __position)      {	size_type __i = __position - _M_ibegin();        this->replace(__position, __position + 1, _M_data(), _M_data());	_M_rep()->_M_set_leaked();	return _M_ibegin() + __i;      }      iterator      erase(iterator __first, iterator __last)      {        size_type __i = __first - _M_ibegin();	this->replace(__first, __last, _M_data(), _M_data());	_M_rep()->_M_set_leaked();       return _M_ibegin() + __i;      }      basic_string&      replace(size_type __pos, size_type __n, const basic_string& __str)      { return this->replace(__pos, __n, __str._M_data(), __str.size()); }      basic_string&      replace(size_type __pos1, size_type __n1, const basic_string& __str,	      size_type __pos2, size_type __n2);      basic_string&      replace(size_type __pos, size_type __n1, const _CharT* __s,	      size_type __n2);      basic_string&      replace(size_type __pos, size_type __n1, const _CharT* __s)      { return this->replace(__pos, __n1, __s, traits_type::length(__s)); }      basic_string&      replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)      { return this->replace(_M_check(__pos), _M_fold(__pos, __n1), __n2, __c); }      basic_string&      replace(iterator __i1, iterator __i2, const basic_string& __str)      { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }      basic_string&      replace(iterator __i1, iterator __i2,                           const _CharT* __s, size_type __n)      { return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); }      basic_string&      replace(iterator __i1, iterator __i2, const _CharT* __s)      { return this->replace(__i1, __i2, __s, traits_type::length(__s)); }      basic_string&      replace(iterator __i1, iterator __i2, size_type __n, _CharT __c);      template<class _InputIterator>        basic_string&        replace(iterator __i1, iterator __i2,		_InputIterator __k1, _InputIterator __k2)        { return _M_replace(__i1, __i2, __k1, __k2,	     typename iterator_traits<_InputIterator>::iterator_category()); }      // Specializations for the common case of pointer and iterator:      // useful to avoid the overhead of temporary buffering in _M_replace.      basic_string&      replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)        { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			       __k1, __k2 - __k1); }      basic_string&      replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2)        { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			       __k1, __k2 - __k1); }      basic_string&      replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)        { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			       __k1.base(), __k2 - __k1);	}      basic_string&      replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2)        { return this->replace(__i1 - _M_ibegin(), __i2 - __i1,			       __k1.base(), __k2 - __k1);	}    private:      template<class _InputIterator>        basic_string&        _M_replace(iterator __i1, iterator __i2, _InputIterator __k1,		   _InputIterator __k2, input_iterator_tag);      template<class _ForwardIterator>        basic_string&        _M_replace_safe(iterator __i1, iterator __i2, _ForwardIterator __k1,		   _ForwardIterator __k2);      // _S_construct_aux is used to implement the 21.3.1 para 15 which      // requires special behaviour if _InIter is an integral type      template<class _InIter>        static _CharT*        _S_construct_aux(_InIter __beg, _InIter __end, const _Alloc& __a,			 __false_type)	{          typedef typename iterator_traits<_InIter>::iterator_category _Tag;          return _S_construct(__beg, __end, __a, _Tag());	}      template<class _InIter>        static _CharT*        _S_construct_aux(_InIter __beg, _InIter __end, const _Alloc& __a,			 __true_type)	{	  return _S_construct(static_cast<size_type>(__beg),			      static_cast<value_type>(__end), __a);	}      template<class _InIter>        static _CharT*        _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a)	{	  typedef typename _Is_integer<_InIter>::_Integral _Integral;	  return _S_construct_aux(__beg, __end, __a, _Integral());        }      // For Input Iterators, used in istreambuf_iterators, etc.      template<class _InIter>        static _CharT*         _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a,		      input_iterator_tag);      // For forward_iterators up to random_access_iterators, used for      // string::iterator, _CharT*, etc.      template<class _FwdIter>        static _CharT*        _S_construct(_FwdIter __beg, _FwdIter __end, const _Alloc& __a,

⌨️ 快捷键说明

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