I just started learning C++ and have a question about vectors. The book I\'m reading states that if I want to extract the size of a vector of type double (for example), I should
The C++ standard says that a container's size_type
is an unsigned integral type, but it doesn't specify which one; one implementation might use unsigned int
and another might use unsigned long
, for example.
C++ isn't "shielded" from platform-specific implementation details as much as Java is. The size_type
alias helps to shield your code from such details, so it'll work properly regardless of what actual type should be used to represent a vector's size.