关于vector 的size()的返回值的值

关于vector 的size()的返回值的值

官方文档的解释如下:

The number of elements in the container.

Member type size_type is an unsigned integral type.

地址如下

所以我用int来和unsigned来进行比较的话,可能会出现问题,

这个在C++Primer里面也有讲.

大意就是溢出之类的.

不过也可以不用管的讲.

猜你喜欢

转载自blog.csdn.net/Huangpengyu123/article/details/106978086