關於vector 的size()的返回值的值

關於vector 的size()的返回值的值

官方文檔的解釋如下:

The number of elements in the container.

Member type size_type is an unsigned integral type.

地址如下

所以我用int來和unsigned來進行比較的話,可能會出現問題,

這個在C++Primer裏面也有講.

大意就是溢出之類的.

不過也可以不用管的講.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章