Sujet : Re: Array size validity and SFINAE
De : Bonita.Montero (at) *nospam* gmail.com (Bonita Montero)
Groupes : comp.lang.c++Date : 02. Mar 2026, 13:21:20
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <10o3vc1$14fgl$1@raubtier-asyl.eternal-september.org>
References : 1 2
User-Agent : Mozilla Thunderbird
Am 01.03.2026 um 16:55 schrieb Marcel Mueller:
You are taking an array by value. This might not be the intention and might take a slice. Since the array index is unsigned -1 is UB or in fact expand to UINT_MAX.
If you write
template <typename T> void foo(int (&)[T::N])
gcc will also output ...
I am unsure whether the overload resolution should take place
before the other checks.
Or better a C++ span with a fixed size.With that you can have bouds-checking wile debugging.
Haut de la page
Les messages affichés proviennent d'usenet.
NewsPortal