Where can I look up the definition of size_type for vectors in the C++ STL?

前端 未结 7 1268
暗喜
暗喜 2021-01-12 21:15

It seems safe to cast the result of my vector\'s size() function to an unsigned int. How can I tell for sure, though? My documentation isn\'t cle

相关标签:
7条回答
  • 2021-01-12 21:52

    It should always be safe to cast it to size_t. unsigned int isn't enough on most 64-bit systems, and even unsigned long isn't enough on Windows (which uses the LLP64 model instead of the LP64 model most Unix-like systems use).

    0 讨论(0)
提交回复
热议问题