• // <string>
    // 字符串(1)
    int compare (const basic_string& str) const;
    // 子串(2)
    int compare (size_type pos, size_type len, const basic_string& str) const;
    int compare (size_type pos, size_type len, const basic_string& str,
                 size_type subpos, size_type sublen) const;
    // C 型字符串(3)
    int compare (const charT* s) const;
    int compare (size_type pos, size_type len, const charT* s) const;
    // 缓存(4)
    int compare (size_type pos, size_type len, const charT* s, size_type n) const;
  • // <string>
    // 字符串(1)
    int compare (const basic_string& str) const noexcept;
    // 子串(2)
    int compare (size_type pos, size_type len, const basic_string& str) const;
    int compare (size_type pos, size_type len, const basic_string& str,
                 size_type subpos, size_type sublen) const;
    // C 型字符串(3)
    int compare (const charT* s) const;
    int compare (size_type pos, size_type len, const charT* s) const;
    // 缓存(4)
    int compare (size_type pos, size_type len, const charT* s, size_type n) const;

basic_string 类模板的公共成员函数。比较字符串。