语法: |
size_type size(); |
返回值类型为size_type,而标准库类型将size_type定义为unsigned类型,进行运算时应注意类型之间的转换。
在c++中,如果表达式中同时有无符号类型和有符号类型,会默认将有符号类型转换为无符号类型进行运算,运算结果也是无符号类型。
语法: |
size_type size(); |
返回值类型为size_type,而标准库类型将size_type定义为unsigned类型,进行运算时应注意类型之间的转换。
在c++中,如果表达式中同时有无符号类型和有符号类型,会默认将有符号类型转换为无符号类型进行运算,运算结果也是无符号类型。