📄 string
字号:
find_if(const_reverse_iterator(__last), rend(), not1(bind2nd(_Eq_traits<_Traits>(), __c))); return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; }}// ------------------------------------------------------------// Non-member functions.// Operator+template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc>operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y){ typedef basic_string<_CharT,_Traits,_Alloc> _Str; typedef typename _Str::_Reserve_t _Reserve_t; _Str __result(_Reserve_t(), __x.size() + __y.size(), __x.get_allocator()); __result.append(__x); __result.append(__y); return __result;}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc>operator+(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { typedef basic_string<_CharT,_Traits,_Alloc> _Str; typedef typename _Str::_Reserve_t _Reserve_t; const size_t __n = _Traits::length(__s); _Str __result(_Reserve_t(), __n + __y.size()); __result.append(__s, __s + __n); __result.append(__y); return __result;}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc>operator+(_CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __y) { typedef basic_string<_CharT,_Traits,_Alloc> _Str; typedef typename _Str::_Reserve_t _Reserve_t; _Str __result(_Reserve_t(), 1 + __y.size()); __result.push_back(__c); __result.append(__y); return __result;}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc>operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { typedef basic_string<_CharT,_Traits,_Alloc> _Str; typedef typename _Str::_Reserve_t _Reserve_t; const size_t __n = _Traits::length(__s); _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator()); __result.append(__x); __result.append(__s, __s + __n); return __result;}template <class _CharT, class _Traits, class _Alloc>inline basic_string<_CharT,_Traits,_Alloc>operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) { typedef basic_string<_CharT,_Traits,_Alloc> _Str; typedef typename _Str::_Reserve_t _Reserve_t; _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator()); __result.append(__x); __result.push_back(__c); return __result;}// Operator== and operator!=template <class _CharT, class _Traits, class _Alloc>inline booloperator==(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;}template <class _CharT, class _Traits, class _Alloc>inline booloperator==(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { size_t __n = _Traits::length(__s); return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;}template <class _CharT, class _Traits, class _Alloc>inline booloperator==(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { size_t __n = _Traits::length(__s); return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;}#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDERtemplate <class _CharT, class _Traits, class _Alloc>inline booloperator!=(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 booloperator!=(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { return !(__s == __y);}template <class _CharT, class _Traits, class _Alloc>inline booloperator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { return !(__x == __s);}#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */// Operator< (and also >, <=, and >=).template <class _CharT, class _Traits, class _Alloc>inline booloperator<(const basic_string<_CharT,_Traits,_Alloc>& __x, const basic_string<_CharT,_Traits,_Alloc>& __y) { return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), __y.begin(), __y.end()) < 0;}template <class _CharT, class _Traits, class _Alloc>inline booloperator<(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { size_t __n = _Traits::length(__s); return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, __y.begin(), __y.end()) < 0;}template <class _CharT, class _Traits, class _Alloc>inline booloperator<(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { size_t __n = _Traits::length(__s); return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), __s, __s + __n) < 0;}#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDERtemplate <class _CharT, class _Traits, class _Alloc>inline booloperator>(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 booloperator>(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { return __y < __s;}template <class _CharT, class _Traits, class _Alloc>inline booloperator>(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { return __s < __x;}template <class _CharT, class _Traits, class _Alloc>inline booloperator<=(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 booloperator<=(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { return !(__y < __s);}template <class _CharT, class _Traits, class _Alloc>inline booloperator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { return !(__s < __x);}template <class _CharT, class _Traits, class _Alloc>inline booloperator>=(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 booloperator>=(const _CharT* __s, const basic_string<_CharT,_Traits,_Alloc>& __y) { return !(__s < __y);}template <class _CharT, class _Traits, class _Alloc>inline booloperator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT* __s) { return !(__x < __s);}#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */// Swap.#ifdef __STL_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 /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */// I/O. (Using istream and ostream only, as opposed to the // basic_istream and basic_ostream templates. The result is that// these functions really don't make all that much sense except// for basic_string<char>.)inline void __sgi_string_fill(ostream& __o, size_t __n){ char __f = __o.fill(); size_t __i; for (__i = 0; __i < __n; __i++) __o.put(__f);}template <class _CharT, class _Traits, class _Alloc>ostream& operator<<(ostream& __os, const basic_string<_CharT,_Traits,_Alloc>& __s){ size_t __n = __s.size(); size_t __pad_len = 0; const bool __left = bool(__os.flags() & ios::left); const size_t __w = __os.width(); if (__w > 0) { __n = min(__w, __n); __pad_len = __w - __n; } if (!__left) __sgi_string_fill(__os, __pad_len); const size_t __nwritten = __os.rdbuf()->sputn(__s.data(), __n); if (__left) __sgi_string_fill(__os, __pad_len); if (__nwritten != __n) __os.clear(__os.rdstate() | ios::failbit); __os.width(0); return __os;}template <class _CharT, class _Traits, class _Alloc>istream& operator>>(istream& __is, basic_string<_CharT,_Traits,_Alloc>& __s){ if (__is.flags() & ios::skipws) { _CharT __c; do __is.get(__c); while (__is && isspace(__c)); if (__is) __is.putback(__c); } if (__is) { __s.clear(); size_t __n = __is.width(); if (__n == 0) __n = (size_t)(-1); else __s.reserve(__n); while (__n-- > 0) { _CharT __c; __is.get(__c); if (!__is) break; else if (isspace(__c)) { __is.putback(__c); break; } __s.push_back(__c); } } __is.width(0); return __is;}template <class _CharT, class _Traits, class _Alloc> istream& getline(istream& __is, basic_string<_CharT,_Traits,_Alloc>& __s, _CharT __delim = '\n') { size_t __nread = 0; if (__is) { __s.clear(); _CharT __c; while (__nread < __s.max_size() && __is.get(__c)) { ++__nread; if (!_Traits::eq(__c, __delim)) __s.push_back(__c); else break; // Character is extracted but not appended. } } if (__nread == 0 || __nread >= __s.max_size()) __is.clear(__is.rdstate() | ios::failbit); return __is;}template <class _CharT, class _Traits, class _Alloc>void _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, _CharT* __buf, size_t __n){ if (__n > 0) { const size_t __n = min(__n - 1, __s.size()); copy(__s.begin(), __s.begin() + __n, __buf); __buf[__n] = _CharT(); }}// ------------------------------------------------------------// Typedefstypedef basic_string<char> string;typedef basic_string<wchar_t> wstring;#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)#pragma reset woff 1174#pragma reset woff 1375#endif__STL_END_NAMESPACE#include <stl_hash_fun.h>__STL_BEGIN_NAMESPACEtemplate <class _CharT, class _Traits, class _Alloc>struct hash<basic_string<_CharT,_Traits,_Alloc> > { size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const { unsigned long __h = 0; for (basic_string<_CharT,_Traits,_Alloc>::const_iterator __i = __s.begin(); __i != __s.end(); ++__i) __h = 5*__h + *__i; return size_t(__h); }};__STL_END_NAMESPACE#endif /* __SGI_STL_STRING */// Local Variables:// mode:C++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -