According to the cppreference documentation on std::uniform_int_distribution
,
The effect is undefined if [
IntType
] is not one of:short
,int
,long
,long long
,unsigned short
,unsigned int
,unsigned long
, orunsigned long long
.
I'm not sure of how this applies to std::size_t
- namely with these 3 confusions:
- On one hand,
std::size_t
, as far as I know, is usually atypedef
of one of theunsigned
types in that list. - However, I'm not sure if the standard mandates that always be the case.
- I'm not sure if "undefined if [
IntType
] is not one of: ..." impliesIntType
has to nominally match something from that list (the type has to explicitly be one of those, by name) or whether it can structurally match (so a typedef to one of those is considered acceptable as well).
Is std::uniform_int_distribution<std::size_t>
undefined behavior?
Aucun commentaire:
Enregistrer un commentaire