C++ Logo

std-discussion

Advanced search

Re: Why is size_type in std::array an alias for size_t?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 08 Nov 2019 16:58:28 -0800
On Thursday, 7 November 2019 22:46:22 PST Wilhelm Meier via Std-Discussion
wrote:
> 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.

No, this is intentional. The std::array::size_type should be the type that
sizeof(actual_array) returns. That's size_t.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2019-11-08 19:00:51