📄 string
字号:
basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str) { __glibcxx_check_erase_range(__i1, __i2); _Base::replace(__i1.base(), __i2.base(), __str); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { __glibcxx_check_erase_range(__i1, __i2); __glibcxx_check_string_len(__s, __n); _Base::replace(__i1.base(), __i2.base(), __s, __n); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { __glibcxx_check_erase_range(__i1, __i2); __glibcxx_check_string(__s); _Base::replace(__i1.base(), __i2.base(), __s); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { __glibcxx_check_erase_range(__i1, __i2); _Base::replace(__i1.base(), __i2.base(), __n, __c); this->_M_invalidate_all(); return *this; } template<typename _InputIterator> basic_string& replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2) { __glibcxx_check_erase_range(__i1, __i2); __glibcxx_check_valid_range(__j1, __j2); _Base::replace(__i1.base(), __i2.base(), __j1, __j2); this->_M_invalidate_all(); return *this; } size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { __glibcxx_check_string_len(__s, __n); return _Base::copy(__s, __n, __pos); } void swap(basic_string<_CharT,_Traits,_Allocator>& __x) { _Base::swap(__x); this->_M_swap(__x); this->_M_invalidate_all(); __x._M_invalidate_all(); } // 21.3.6 string operations: const _CharT* c_str() const { const _CharT* __res = _Base::c_str(); this->_M_invalidate_all(); return __res; } const _CharT* data() const { const _CharT* __res = _Base::data(); this->_M_invalidate_all(); return __res; } using _Base::get_allocator; size_type find(const basic_string& __str, size_type __pos = 0) const { return _Base::find(__str, __pos); } size_type find(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find(__s, __pos, __n); } size_type find(const _CharT* __s, size_type __pos = 0) const { __glibcxx_check_string(__s); return _Base::find(__s, __pos); } size_type find(_CharT __c, size_type __pos = 0) const { return _Base::find(__c, __pos); } size_type rfind(const basic_string& __str, size_type __pos = _Base::npos) const { return _Base::rfind(__str, __pos); } size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string_len(__s, __n); return _Base::rfind(__s, __pos, __n); } size_type rfind(const _CharT* __s, size_type __pos = _Base::npos) const { __glibcxx_check_string(__s); return _Base::rfind(__s, __pos); } size_type rfind(_CharT __c, size_type __pos = _Base::npos) const { return _Base::rfind(__c, __pos); } size_type find_first_of(const basic_string& __str, size_type __pos = 0) const { return _Base::find_first_of(__str, __pos); } size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find_first_of(__s, __pos, __n); } size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_check_string(__s); return _Base::find_first_of(__s, __pos); } size_type find_first_of(_CharT __c, size_type __pos = 0) const { return _Base::find_first_of(__c, __pos); } size_type find_last_of(const basic_string& __str, size_type __pos = _Base::npos) const { return _Base::find_last_of(__str, __pos); } size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find_last_of(__s, __pos, __n); } size_type find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const { __glibcxx_check_string(__s); return _Base::find_last_of(__s, __pos); } size_type find_last_of(_CharT __c, size_type __pos = _Base::npos) const { return _Base::find_last_of(__c, __pos); } size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const { return _Base::find_first_not_of(__str, __pos); } size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string_len(__s, __n); return _Base::find_first_not_of(__s, __pos, __n); } size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_check_string(__s); return _Base::find_first_not_of(__s, __pos); } size_type find_first_not_of(_CharT __c, size_type __pos = 0) const { return _Base::find_first_not_of(__c, __pos); } size_type find_last_not_of(const basic_string& __str, size_type __pos = _Base::npos) const { return _Base::find_last_not_of(__str, __pos); } size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find_last_not_of(__s, __pos, __n); } size_type find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const { __glibcxx_check_string(__s); return _Base::find_last_not_of(__s, __pos); } size_type find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const { return _Base::find_last_not_of(__c, __pos); } basic_string substr(size_type __pos = 0, size_type __n = _Base::npos) const { return basic_string(_Base::substr(__pos, __n)); } int compare(const basic_string& __str) const { return _Base::compare(__str); } int compare(size_type __pos1, size_type __n1, const basic_string& __str) const { return _Base::compare(__pos1, __n1, __str); } int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); } int compare(const _CharT* __s) const { __glibcxx_check_string(__s); return _Base::compare(__s); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 5. string::compare specification questionable int compare(size_type __pos1, size_type __n1, const _CharT* __s) const { __glibcxx_check_string(__s); return _Base::compare(__pos1, __n1, __s); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 5. string::compare specification questionable int compare(size_type __pos1, size_type __n1,const _CharT* __s, size_type __n2) const { __glibcxx_check_string_len(__s, __n2); return _Base::compare(__pos1, __n1, __s, __n2); } _Base& _M_base() { return *this; } const _Base& _M_base() const { return *this; } using _Safe_base::_M_invalidate_all; }; template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, _CharT __rhs) { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator==(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs == __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() == __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator!=(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs != __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() != __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs < __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() < __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<=(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs <= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() <= __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>=(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs >= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() >= __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs > __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() > __rhs; } // 21.3.7.8: template<typename _CharT, typename _Traits, typename _Allocator> inline void swap(basic_string<_CharT,_Traits,_Allocator>& __lhs, basic_string<_CharT,_Traits,_Allocator>& __rhs) { __lhs.swap(__rhs); } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str) { return __os << __str._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_istream<_CharT,_Traits>& operator>>(std::basic_istream<_CharT,_Traits>& __is, basic_string<_CharT,_Traits,_Allocator>& __str) { std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base(); __str._M_invalidate_all(); return __res; } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_istream<_CharT,_Traits>& getline(std::basic_istream<_CharT,_Traits>& __is, basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim) { std::basic_istream<_CharT,_Traits>& __res = getline(__is, __str._M_base(), __delim); __str._M_invalidate_all(); return __res; } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_istream<_CharT,_Traits>& getline(std::basic_istream<_CharT,_Traits>& __is, basic_string<_CharT,_Traits,_Allocator>& __str) { std::basic_istream<_CharT,_Traits>& __res = getline(__is, __str._M_base()); __str._M_invalidate_all(); return __res; }} // namespace __gnu_debug#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -