此文献给好友风临神上(^-^)
结论是,两者没有任何区别。
解释:
C++ Reference中对于String字符串中函数size和length的解释是这样的:
size | Return length of string |
---|---|
length | Return length of string |
连两者的具体解释都一样:
std::string::size
Return length of string
Returns the length of the string, in terms of bytes.
This is the number of actual bytes that conform the contents of the string, which is not necessarily equal to its storagecapacity.
Note that string objects handle bytes without knowledge of the encoding that may eventually be used to encode the characters it contains. Therefo