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-09 10:01:48


On Friday, 8 November 2019 23:23:59 PST Wilhelm Meier via Std-Discussion
wrote:
> Well, on one side this is understandable, but on the other side an
> implementation für small µC could get some benefit from declaring
> size_type to the small unsigned integer possible for the actual size of
> the array. And I don't see any obstackles doing so.

I don't see the point. If you want to *store* the information, you're not
using std::array, it's your choice. If you want to *manipulate* the size, then
integer promotion rules apply anyway and you're going to get either int or
unsigned, which in your microcontroller is likely going to be the same size as
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