I have a function (and a constructor) that should be able to take integer and floating point values. In fact I want it to take an int64_t
or a long double
, so what I want is,
class Foo {
public:
Foo(int64_t value=0);
Foo(long double value);
};
However if I do this and try Foo f = 1;
the compiler complains about the conversion from int
to Foo
being ambiguous. Ok, but if I change the first constructor to take a int32_t
there is no such ambiguity. Can anyone explain to me why this is the case.