📄 _string.h
字号:
return *this; } iterator erase(iterator __position) { __check_if_owner(&_M_iter_list, __position); __invalidate_iterator(&_M_iter_list,end()); return iterator(&_M_iter_list, _Base::erase(__position._M_iterator)); } iterator erase(iterator __first, iterator __last) { __check_range(__first, __last)&&__check_if_owner(&_M_iter_list,__first); if (__first != __last) { __invalidate_range(&_M_iter_list, __last, end()); } return iterator(&_M_iter_list, _Base::erase(__first._M_iterator, __last._M_iterator)); }public: // Substring. _Self substr(size_type __pos = 0, size_type __n = _Base::npos) const { if (__pos > this->size()) this->_M_throw_out_of_range(); return _Self(this->begin() + __pos, this->begin() + __pos + min(__n, this->size() - __pos), allocator_type()); }public: // Replace. (Conceptually equivalent // to erase followed by insert.) _Self& replace(size_type __pos, size_type __n, const _Self& __s) { _Base::replace(__pos, __n, __s); return *this; } _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) { _Base::replace(__pos1, __n1, (const _Base&)__s, __pos2, __n2); return *this; } _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { _STLP_FIX_LITERAL_BUG(__s) _Base::replace(__pos, __n1, __s, __n2); return *this; } _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) _Base::replace(__pos, __n1, __s); return *this; } _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { _Base::replace(__pos, __n1, __n2, __c); return *this; } _Self& replace(iterator __first, iterator __last, const _Self& __s) { __check_if_owner(&_M_iter_list,__first); __check_range(__first, __last); _Base::replace(__first._M_iterator, __last._M_iterator,__s); return *this; } _Self& replace(iterator __first, iterator __last, const _CharT* __s, size_type __n) { _STLP_FIX_LITERAL_BUG(__s) __check_if_owner(&_M_iter_list,__first); __check_range(__first, __last); _Base::replace(__first._M_iterator, __last._M_iterator,__s, __n); return *this; } _Self& replace(iterator __first, iterator __last, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) __check_if_owner(&_M_iter_list,__first); __check_range(__first, __last); _Base::replace(__first._M_iterator, __last._M_iterator,__s); return *this; } _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c) { __check_if_owner(&_M_iter_list,__first); __check_range(__first, __last); _Base::replace(__first._M_iterator, __last._M_iterator, __n, __c); return *this; }#ifdef _STLP_MEMBER_TEMPLATES template <class _InputIter> _Self& replace(iterator __first, iterator __last, _InputIter __f, _InputIter __l) { __check_if_owner(&_M_iter_list, __first); __check_range(__first, __last); __check_range(__f, __l); _Base::replace(__first._M_iterator, __last._M_iterator, __f, __l); return *this; }#else /* _STLP_MEMBER_TEMPLATES */ _Self& replace(iterator __first, iterator __last, const _CharT* __f, const _CharT* __l) { __check_if_owner(&_M_iter_list, __first); __check_range(__first, __last); __check_range(__f, __l); _Base::replace(__first._M_iterator, __last._M_iterator, __f, __l); return *this; } _Self& replace(iterator __first, iterator __last, const_iterator __f, const_iterator __l) { __check_if_owner(&_M_iter_list, __first); __check_range(__first, __last); __check_range(__f, __l); _Base::replace(__first._M_iterator, __last._M_iterator, __f._M_iterator, __l._M_iterator); return *this; } #endif /* _STLP_MEMBER_TEMPLATES */public: // Other modifier member functions. void swap(_Self& __s) { _M_iter_list._Swap_owners(__s._M_iter_list); _Base::swap(__s); }};// This is a hook to instantiate STLport exports in a designated DLL# if defined (_STLP_USE_TEMPLATE_EXPORT)_STLP_EXPORT template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;# if defined (_STLP_HAS_WCHAR_T)_STLP_EXPORT template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;# endif# endif /* _STLP_USE_TEMPLATE_EXPORT */// ------------------------------------------------------------// Non-member functions.template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const basic_string<_CharT,_Traits,_Alloc>& __s, const basic_string<_CharT,_Traits,_Alloc>& __y){ return basic_string<_CharT,_Traits,_Alloc>(*__s._Get_base() + *__y._Get_base());}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return basic_string<_CharT,_Traits,_Alloc>(__s + *__y._Get_base());}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(_CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __y) { return basic_string<_CharT,_Traits,_Alloc>(__c + *__y._Get_base());}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return basic_string<_CharT,_Traits,_Alloc>(*__x._Get_base()+ __s);}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) { return basic_string<_CharT,_Traits,_Alloc>(*__x._Get_base() + __c);}#ifdef _STLP_EXTRA_OPERATORS_FOR_DEBUG// Operator== and operator!=template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator==(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return (*__x._Get_base() == *__y._Get_base());}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator==(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return (__s == *__y._Get_base());}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator==(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return (*__x._Get_base() == __s);}// Operator< (and also >, <=, and >=).template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator<(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return (*__x._Get_base() < *__y._Get_base());}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator<(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return (__s < *__y._Get_base()); }template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator<(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return (*__x._Get_base() < __s);}#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACEtemplate <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return !(__x == __y);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator>(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return __y < __x;}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return !(__y < __x);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return !(__x < __y);}#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator!=(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return !(__s == __y);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return !(__x == __s);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator>(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return __y < __s;}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator>(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return __s < __x;}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator<=(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return !(__y < __s);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return !(__s < __x);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator>=(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { _STLP_FIX_LITERAL_BUG(__s) return !(__s < __y);}template <class _CharT, class _Traits, class _Alloc>inline bool _STLP_CALLoperator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return !(__x < __s);}#endif /* if 0 */// Swap.#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDERtemplate <class _CharT, class _Traits, class _Alloc>inline void swap(basic_string<_CharT,_Traits,_Alloc>& __x, basic_string<_CharT,_Traits,_Alloc>& __y) { __x.swap(__y);}#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */// I/O. #ifdef _STLP_EXTRA_OPERATORS_FOR_DEBUG#if defined (_STLP_USE_NEW_IOSTREAMS) && ! defined (_STLP_OWN_IOSTREAMS)template <class _CharT, class _Traits, class _Alloc>basic_ostream<_CharT, _Traits>& _STLP_CALLoperator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT,_Traits,_Alloc>& __s) { return __os << *__s._Get_base();}template <class _CharT, class _Traits, class _Alloc>basic_istream<_CharT, _Traits>& _STLP_CALLoperator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT,_Traits,_Alloc>& __s) { return __is >> *__s._Get_base();}#elif ! defined ( _STLP_USE_NO_IOSTREAMS )template <class _CharT, class _Traits, class _Alloc>ostream& _STLP_CALL operator<<(ostream& __os, const basic_string<_CharT,_Traits,_Alloc>& __s) { return __os << *__s._Get_base();}template <class _CharT, class _Traits, class _Alloc>istream& _STLP_CALL operator>>(istream& __is, basic_string<_CharT,_Traits,_Alloc>& __s) { return __is >> *__s._Get_base();}#endif /* _STLP_USE_NEW_IOSTREAMS */#endif /* if _STLP_EXTRA_OPERATORS_FOR_DEBUG */_STLP_END_NAMESPACE#endif /* _STLP_DBG_STRING */// Local Variables:// mode:C++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -