C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Why is size_type in std::array an alias for size_t?
From: Thiago Macieira (thiago_at_[hidden])
Date: 2019-11-08 18:58:28


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

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

Older Archives on Google Groups