What might be another way to test if int is 32 bits wide at compile time?
In C++, sizeof returns the size of a number relative to the size of char.

So, sizeof(int) should give you how many chars each int takes.

Next, we need to know how many bits each char has. CHAR_BIT has that information.

So try this:

constexpr size_t bits_per_int = sizeof(int) * CHAR_BIT;
constexpr bool intbitwidthcheck = (bits_per_int == 32);


Frankly, I believe this way is more readable.

Not to mention, can one reasonably expect a 32-bits signed int to contain values up to 2^32 - 1? Shouldn't that be the UINT_MAX? INT_MAX should be up to 2^31 - 1.