Subject: Re: Why is size_type in std::array an alias for size_t?
From: Lyberta (lyberta_at_[hidden])
Date: 2019-11-09 02:52:00
Wilhelm Meier via Std-Discussion:
> using size_type = std::condifition_t<(Size < 256), uint8_t,
> std::conditional_t<(Size < 65536), uint16_t, ... >>>;
If size_type is std::uint8_t then difference_type is std::int8_t and
maximum size of such array is 127.
Of course, bigger problem is that CHAR_BIT can be more than 8.
Generally, there are no fixed bit sizes that we can use in standard library.
Also, unsigned sizes just don't work given the rules of the language
when it comes to arithmetic. We now have std::ssize to get signed sizes
of containers and views.
STD-DISCUSSION list run by email@example.com
Older Archives on Google Groups