C++ Logo

STD-DISCUSSION

Advanced search

Subject: Why is size_type in std::array an alias for size_t?
From: Wilhelm Meier (wilhelm.meier_at_[hidden])
Date: 2019-11-08 00:46:22


Hello all,

the member type size_type is an alias for size_t in std::array:

https://en.cppreference.com/w/cpp/container/array

The member type size_type in std::vector is an unspecified unsigned
integer type:

https://en.cppreference.com/w/cpp/container/vector

I wonder, if this is intentional, since std::array could declare the
size_type depending on the actual size of the array, e.g. an
implementation could declare size_type an alias to uint8_t if the size
of the array is less than 256 or uint16_t if the size of the array is
less than 65536.

Is this a documentation issue?

Thanks,
 Wilhelm


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups