C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A better std::byte type

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Thu, 25 Jun 2026 14:59:16 +0100
On Thu, 25 Jun 2026 at 14:34, Rune Lund Olesen via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hello All,
>
> The current std::byte has some deep issues in that it is too opaque to the point it is flawed by design.
> (we know it is in reality a scoped enum).
> Especially this comes up in generic code where it is cumbersome to add specializations because it is not a fundamental type.

Could you expand on this point? Why is it cumbersome to add
specializations, and why does it matter that it's not a fundamental
type? Why is it easier to add specializations for fundamental types?

> A "better" way would be a real fundamental type or struct that mimicks it...

How would a struct help, that wouldn't be a fundamental type either?

> Overall it should at least behave like a fundamental uint8_t/unsigned char in most respects
> and be easy to convert to/from...

Why? You haven't justified this at all.

Why does std::is_fundamental<std::byte> matter?

> except ofc. it shouldn't be an arithmetic type and it shouldn't be treated like a textual "char" as we know.

Which is true for std::byte today.

Received on 2026-06-25 13:59:33