-
- Downloads
bigunsignedint: make overload unambiguous for all integer types
With just the two overloaded constructors bigunsignedint(int) bigunsigendint(uintmax_t) trying to call the constructor with any integer type T different from int and uintmax_t results in an ambiguous call: the promotion of T to either int or uintmax_t are ranked the same. (Note that this does not depend on the specific choice of int and uintmax_t.) This patch provides a templated constructor for all signed integer types which is ranked over the constructor taking an uintmax_t, making overload resolution unambiguous for signed integer types. By also "hiding" it for unsigned types using enable_if, the overload resolution for unsigned integer types is also unambiguous; there is only a single viable candidate left: the one taking an uintmax_t.
Loading
Please register or sign in to comment