I overloaded the 'pow' duty to permit for (Complex, int) operation, but in this specific instance I gain an error saying:

no instance of overloaded role "pow" matches the dispute list. Argument species are: (Complex, int)

Here's the pow function definition:

Complex pow(Complex & c, int n) Complex temp;temp = temp.toXY(pow(c.getArg(), n), c.getPhase()*n);return temp;Here's the problem code:

Complex DFTsum(const Complex* x, int N, int k) { //calculate sum x*v^nDFTVector v(N);Complex ret = 0;for (int n = 0; n and here's v:

Complex operator <> (int k) return Complex(cos((2 * PI*k) / N), sin((2 * PI*k) / N));

v returns object type Complex, and pow accepts (Complex, int) therefore why perform I acquire this error?




You are watching: No instance of overloaded function matches the argument list

2 comments
share
save
hide
report
100% Upvoted
Log in or sign up to leave a comment
Log InSign Up
Sort by: best


*

level 1
· 3 yr. Ago
Complex operator <> (int k) return Complex(cos((2 * PI*k) / N), sin((2 * PI*k) / N)); This role returns a momentary object and also your pow desires a call-by-reference which does not work together.

Either you happen it by copy or const-ref


4
Reply
Share
ReportSaveFollow
level 1
· 3 yr. Ago

OT: you recognize there exist a std::complex?


2
Reply
Share
ReportSaveFollow
r/cpp_questions
a subdiscoverhotmail.com for c++ questions and also answers
51.1k

Members


72

Online


Created jan 15, 2012
Join
*
*
*
*

*

Top articles december 24th 2018Top articles of december, 2018Top posts 2018
helpdiscoverhotmail.com coinsdiscoverhotmail.com premiumdiscoverhotmail.com gifts
aboutcareerspressadvertiseblogTermsContent policyPrivacy policyMod policy


See more: Emollit Mores Nec Sinit Esse Feros, Universitas Carolin Merid

Back come Top