libstdc++: Handling user-defined interlike object in submdspan.

Ville Voutilainen ville.voutilainen@gmail.com
Mon Sep 29 12:55:38 GMT 2025


On Mon, 29 Sept 2025 at 15:27, Luc Grosheintz <luc.grosheintz@gmail.com> wrote:
>
> Dear libstdc++ devs,
>
> While implementing submdspan, I ran into difficulty related to
> user-defined "integers", i.e. any class that converts to `index_type`
> (the latter is always a signed or unsigned integer).
>
> The user-defined types might not be copyable or only convert to
> `index_type` from an rvalue.

Perhaps they should be required to be copyable and convertible from lvalues, and
if the spec doesn't allow such a requirement, the spec should be fixed.

I find it hard-fetched to have such wrinkles in types that are, for
all purposes, supposed to emulate
built-in types as far as possible, like custom number types are supposed to.


More information about the Libstdc++ mailing list