C++ Logo

std-proposals

Advanced search

Re: Templated access to the standard integer types?

From: John McFarlane <john_at_[hidden]>
Date: Sun, 2 Jun 2019 11:21:53 +0200
On Sun, 2 Jun 2019 at 09:51, Eyal Rozenberg via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> C++ supports, through <cstdint>, exact-width integer types: int8_t,
> int16_t, uint8_t, uint16_t, and so on for larger sizes.
>
> In many cases you want to use template parameter(s) to choose from among
> these types, i.e. have an int_t<8>, int_t<16>, uint_t<8> and so on.
> Boost basically has this, with even more functionality:
>
>
> https://www.boost.org/doc/libs/1_70_0/libs/integer/doc/html/boost_integer/integer.html
>
> Has there been a proposal to add at least an `std::int_t<N>` and
> `std::uint_t<N>` type templates to the standard library? Or perhaps a
> `std::signed_integer_t<N>`, `std::unsigned_integer_t<N>`, and a
> `std::integer<Signedness, N>` ?
>
> If so, can someone link to it,


wg21.link/p0102

to the discussion of it,


This comes up from time to time, e.g. earlier this year
<https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f1eada83-f684-4cd1-969a-d20f79e84d72%40isocpp.org?utm_medium=email&utm_source=footer>
.


> and explain
> briefly why it was rejected? And if not - what do you think about this
> possibility?
>

I'd like to see the integer family (e.g. `unsigned`, `signed` etc.) as a
parameter and for this to be a customisation point.

John

Received on 2019-06-02 04:23:50