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.