Reputation: 3740
I have an overloaded pair of functions that take a single argument. One takes a uint64_t
. The other takes an int64_t
. When I pass a uint32_t
to the function it is correctly flagged as ambiguous.
How do I resolve this ambiguity without resorting to templates? I can write a shallow wrapper that uses type traits to resolve it, but I would rather not. I would prefer for signed types to resolve to the signed overload, and unsigned types to resolve to the unsigned overload.
Also, I would rather not have an overload for each integer type.
Upvotes: 0
Views: 245
Reputation: 303890
You have several options at your disposal:
int64_t
or uint64_t
.(3) would be (in my opinion) the clearest, (2) would be the most verbose, and (1) would require the most work on your users.
Upvotes: 2