Note that there are some explanatory texts on larger screens.

plurals
  1. USbrunocodutra
    primarykey
    data
    text
    plurals
    1. This table or related slice is empty.
    1. CO@DyP I thought that could indeed be the case, but instead of looking at the standard I chose the dirty hacky shortcut: ask clang what it thinks about that and it didn't even warn. I can only see one possible solution then, that is define a custom *common-type-like* metafunction. We could also check if the recursion `std::common_type` implements is required by the standard to be *L-fold like*, for then we could require `ranged_type` to always be the first argument and deal with the signed/unsigned gory details inside our specializations. How can I have access to the standard to check this out?
      singulars
    2. CO@DyP yes, we could specialize `common_type` for combinations of `ranged_integer` and these third party's extended integer types, but I believe that is not guaranteed to work, for their interaction with primitive integers might rely on the original behavior of `common_type` and thus break.
      singulars
    3. CO@DyP you are right, hence my warning at the begining of my answer, but since the OP didn't mention he expects the mechanism to be valid for nothing else than primitive types and his `ranged_integer` and, at the same time, wanted `std::common_type<int, unsigned, ranged_integer<0, std::numeric_limits<unsigned>::max() + 1>` to work, there's no other way, we must guarantee `std::common_type<int, unsigned>` does not yield `unsigned`. Again I should point out that a custom *common-type-like* metafunction would be best.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload