Skip to content
Snippets Groups Projects
Commit 7d2a12f8 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

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.
parent 541b3dfc
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment