Reputation: 1371
I am getting the error:
ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
Distribution.H:515: note: candidate 1: Probability Normal::cdf(float64_t) const
Distribution.H:512: note: candidate 2: Probability Normal::cdf(const RationalVector&)"
RationalVector is defined as
class RationalVector : public Array<float64_t>
I am not able to change this class or the 'cdf' functions, as they are part of a third-party library. My code is giving the error for the following line:
return cABS*( exp(Md + 0.5*Vd)*stdN.cdf(d1) - K*stdN.cdf(d2) );
Where d1 and d2 are both doubles. I have tried casting both of them to float64_t to force the use of the first cdf function as such:
return cABS*( exp(Md + 0.5*Vd)*stdN.cdf((float64_t)d1) - K*stdN.cdf((float64_t)d2) );
However, the error still persists.
The Normal functions are defined as:
Probability cdf(float64_t x) const;
Probability cdf(RationalVector const & x);
Any ideas as to what the issue is, or how to fix it?
Upvotes: 0
Views: 1550
Reputation: 136256
The second overload misses const
, this may be the reason for ambiguity.
Try making stdN
a const object if you intend to invoke the first overload.
Upvotes: 1