A character sequence consisting of count1
characters starting at data1
is compared to a character sequence consisting of count2
characters starting at data2
as follows. First, calculate the number of characters to compare, as if by size_type rlen = std::min(count1, count2)
. Then compare the sequences by calling Traits::compare(data1, data2, rlen)
. For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the character sequences are equal so far), then their sizes are compared as follows:
当s1和s2作比较:(翻一下文档的解释)
先取s1,s2的较短长度作为比较长度,然后按该长度进行比较,若出现ASCII码的差,直接返回,若没有出现差,再判断二者的size,size1>size2,则返回>0.