13 hours ago, Bregma said:Yes. std::size_t is always the appropriate type to express sizes.
An index is not a size, it's a difference. It should be expressed as a signed integer.
An index points to something that does have a size, so as far as the range of the values of allocation size and the index that navigates it... there's no real difference.
If you're unsure about the size of the data that you're iterating through, use size_t. If you know the max size, then use the appropriate type.